Business Rule
HedgeEm uses a standard 52-card deck (4 suits × 13 ranks). The deck is shuffled server-side before each game. Cards are dealt without replacement — once a card is assigned to a hole hand or a community card position, it cannot appear again in the same game.- Hole cards: 2 per hand × number of hands (e.g. 6 cards for 3 hands)
- Community cards: exactly 5 (flop 1, 2, 3; turn; river)
- Total cards used per game:
2 × numHands + 5(e.g. 11 for 3 hands) - Cards remaining undealt:
52 − (2 × numHands + 5)(e.g. 41 for 3 hands — never revealed)
2–9, T, J, Q, K, A) followed by suit (c=clubs, d=diamonds, h=hearts, s=spades). e.g. Ac = Ace of clubs, Th = Ten of hearts.
Technical Design
Server-side shuffling
The REST API shuffles the deck server-side (Fisher-Yakes or equivalent). The shuffled deck is used to:- Deal 2 hole cards per hand — returned as
hands[](4-char strings) in theSTATUS_HOLEAPI response - Deal 5 community cards — returned as
flopCard1–flopCard3,turnCard,riverCardin each stage response
UMA client state bridge
Card token format
GDK card translation
platform.js translates 2-char tokens to GDK card objects via restToGdkCard(s) before passing to the game engine. The translation maps rank characters to integers (2–14) and suit characters to integers (0–3).
Acceptance Criteria
- AC1 — After advancing to RIVER,
_stageCardscontains exactly 5 non-null community card tokens (flopCard1, flopCard2, flopCard3, turnCard, riverCard) - AC2 — All card tokens (hole cards + community cards) are valid 2-char strings: rank in
{2–9, T, J, Q, K, A}, suit in{c, d, h, s} - AC3 — No card token appears more than once across all hole cards AND all community cards (global deck integrity)
- AC4 — Total unique cards dealt equals
2 × handCount + 5(e.g. 11 for 3 hands) - AC5 — Community cards are revealed progressively: flopCard1–3 non-null at FLOP; turnCard non-null at TURN; riverCard non-null at RIVER
Version Parity
Known Discrepancies
None documented yet.Test Coverage
Playwright spec:tests/features/F002-deck-management.spec.ts — AC1–AC5.
Run with: