Add real replay variety: 15 new letters, random per-day roster
All checks were successful
Docker / build-and-push (push) Successful in 36s

Every playthrough showed the exact same fixed 30 letters in the exact
same order — no randomization anywhere in the codebase. Added 15 new
letters (3 per day, l31-l45), bringing each day's pool to 9, and
changed the engine to draw PER_DAY_COUNT (6) at random from that pool
per game instead of always using the same fixed set.

- engine.ts: buildRoster() shuffles each day's pool and takes the
  first 6; GameState now carries a `roster` (letter ids in day order)
  generated once at createState() and persisted with the rest of the
  save. lettersForDay/currentLetter read through the roster instead
  of the full LETTERS array directly.
- Save key bumped to v3 — old saves have no roster field, and
  backfilling one wouldn't match already-recorded decisions, so old
  saves are simply ignored rather than partially migrated.
- Tests rewritten: several previously asserted specific letter ids at
  specific positions, which no longer holds under randomization.
  Split into buildRoster() property tests (right count, no dupes,
  every id resolves, different seeds differ) and engine tests that
  either check general correctness or construct an explicit roster
  when a specific letter's behavior needs locking in (l22, l04).

Verified: 11/11 vitest, tsc clean, and a real 5-fresh-games browser
test confirming 5 different first-letter senders instead of the same
one every time.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-07-28 21:12:06 +02:00
parent f71878861c
commit 6c9b313783
6 changed files with 305 additions and 37 deletions

View File

@@ -30,6 +30,7 @@ npm run build
- Incorrect sorting costs composure and raises suspicion.
- A completed day restores one composure; suspicion persists.
- Survive all five days to receive a permanent position. This is not necessarily a reward.
- Each day draws 6 letters at random from a larger pool (currently 9) — every playthrough sees a different subset, so a second run doesn't mean already knowing every answer.
Keyboard: `1``4` selects a route, `Enter` stamps or continues, `?` opens help.