Business Rule
A game of Texas HedgeEm progresses through five stages in a fixed sequence. The player cannot skip or reverse stages.- Pre-deal — The table is idle. Only the Deal button is visible. No cards are shown.
- Hole (PRE-FLOP) — Two hole cards are dealt to each hand. All hole cards are face-up. Five community card positions are visible as face-down card backs. Betting is open on all live hands.
- Flop (POST-FLOP) — Three community cards are turned face-up. Betting remains open.
- Turn — A fourth community card is turned face-up. Betting remains open.
- River — The fifth and final community card is turned face-up. Betting closes. All bets are resolved and winnings paid out. The Deal button reappears for the next game.
Stage naming (design document vs implementation)
The game concept document uses these stage names:| Design doc name | HedgeEm dealStatus | Cards visible at betting open |
|---|---|---|
| ANTE-BET | Pre-deal (−1) | None — not yet implemented |
| PRE-FLOP | Hole (0) | Hole cards only |
| POST-FLOP | Flop (1) | Hole + 3 community |
| TURN | Turn (2) | Hole + 4 community |
| (no betting) | River (3) | All 5 community |
Technical Design
State representation
| Stage | dealStatus | GameStateEnum |
|---|---|---|
| Pre-deal | -1 | — |
| Hole | 0 | STATUS_HOLE = 6 |
| Flop | 1 | STATUS_FLOP = 10 |
| Turn | 2 | STATUS_TURN = 11 |
| River | 3 | STATUS_RIVER = 12 |
GameStateEnum values match the original C# server enum_game_state — they are stored in HandStageInfo.enumGameState in every game record.
State transitions (TypeScript — GameEngine)
advance() returns false at river so the caller knows not to update UI.
Deal flow (GameScene._onDeal)
Advance flow (GameScene._onAdvance)
Community card reveal schedule
Hole card reveal rule
CC_DEAL_CARDx states before opening the betting window.
Note: an earlier version of this doc stated only hand 0 was revealed at hole. That was incorrect and was fixed by HEDGE-135.
HandStageInfo indexing
GameRecord.handStageInfoList is a flat array of n × 4 entries (n = number of hands, 4 stages).
The entry for a given (stage, hand) is at index dealStatus * n + handIndex.
Acceptance Criteria
- On page load, only the Deal button is visible; no cards or hand panels are shown
- Clicking Deal transitions to hole stage: cards appear, Advance button visible, Deal button hidden
- At hole stage: hand 0 hole cards are face-up; hands 1–3 hole cards are face-down card backs
- At hole stage: all 5 community card slots show face-down card backs
- Clicking Advance at hole → flop: 3 community cards revealed face-up; all hole cards now face-up
- Clicking Advance at flop → turn: 4th community card revealed; 5th still face-down
- Clicking Advance at turn → river: all 5 community cards face-up; Deal button reappears
-
advance()returnsfalseat river and does not incrementdealStatusbeyond 3 -
isGameOveristrueonly atdealStatus === 3 -
resolveBets()is called exactly once, after the river advance
Version Parity
| Version | Status | Notes |
|---|---|---|
| JavaScript | ⬜ Not yet audited | Reference implementation at hedgeem.qeetoto.com |
| TypeScript | ✅ Implemented | GameEngine.advance(), GameScene._onDeal(), GameScene._onAdvance() |
| UMA | ⬜ Not yet started | GDK-wrapped, same stage logic expected |
Known Discrepancies
None documented yet.Test Coverage
Playwright spec:tests/features/F004-game-stages.spec.ts — not yet created.
Existing partial coverage in standalone_reference_client/tests/e2e/smoke.spec.ts:
screenshot: full game cycle — deal → flop → turn → river— covers stage transitions visuallybetting: full cycle— assertsdealStatus === 3andgameOver === trueat river
standalone_reference_client/tests/unit/GameEngine.test.ts:
advances to hole (0) on first advance()advances through all four stagesreturns false from advance() when already at riverisGameOver is true at river
