fix second spec review: tap-only bingo, announcement schema, broadcast pattern

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-13 08:51:23 +01:00
parent cdf878fe9b
commit f9e493cd9d

View File

@@ -137,7 +137,7 @@ Shows the player's current bingo card. Same `BingoCard` component as today, with
When a player completes a bingo line:
1. **Server detects completion**the server already detects bingo lines and awards 10 bonus points. Extended to mark the card as `completed`.
1. **Server detects completion**on every tap (not untap), the server checks for completed bingo lines. Tapping is tap-only (no toggle/untap) — once a square is marked, it stays marked. When a line is detected, the card is marked as `completed`.
2. **Card stored** — the completed card moves to a `completedBingoCards` array in game state (per player). Contains: `playerId`, `displayName`, `card` (the full card data with marked squares), `completedAt` (ISO 8601 timestamp).
3. **Player sees** — a celebration message ("Bingo!") + "Draw New Card" button.
4. **Redraw** — new WS message `request_new_bingo_card`. Server generates a fresh card with tropes not present on the just-completed card (best effort — if the trope pool is exhausted, duplicates are allowed). The old card is already in `completedBingoCards`.
@@ -150,7 +150,7 @@ Bingo points accumulate across all cards (completed + active). `getBingoScore()`
- 2 points per tapped square across all completed cards and the active card
- 10 bonus points per completed bingo line (each completed card contributed at least one line; the active card may also have lines)
The `announcedBingo` set is changed to track `playerId:cardIndex` instead of just `playerId`, so multiple bingo announcements per player are possible.
The `announcedBingo` set is changed to track `playerId:cardIndex` instead of just `playerId`, so multiple bingo announcements per player are possible. The existing `bingoAnnouncedMessage` schema stays unchanged (it carries `playerId` and `displayName`) — the display view shows "Player X got Bingo!" regardless of which card number it is. The `completedBingoCards` array length implicitly tracks the count.
### Data Changes
@@ -285,6 +285,8 @@ Unchanged. Full-screen passive view, no bottom nav. Continues to show:
- Add `request_new_bingo_card` case to handler, gated to `live-event` act
- Add the message to the `clientMessage` discriminated union in `ws-messages.ts`
- Change `tapBingoSquare` from toggle to tap-only (remove untap behavior)
- Both `tap_bingo_square` and `request_new_bingo_card` responses use the existing pattern: full `game_state` broadcast to all players in the room (consistent with all other state mutations)
### Route Transition Safety