Skip to main content

Business Rule

A game of Texas HedgeEm progresses through five stages in a fixed sequence. The player cannot skip or reverse stages.
  1. Pre-deal — The table is idle. Only the Deal button is visible. No cards are shown.
  2. 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.
  3. Flop (POST-FLOP) — Three community cards are turned face-up. Betting remains open.
  4. Turn — A fourth community card is turned face-up. Betting remains open.
  5. 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.
The player advances from Hole → Flop → Turn → River by clicking the Advance button once per stage.

Stage naming (design document vs implementation)

The game concept document uses these stage names: The design doc states the default configuration is POST-FLOP only (single betting stage). The reference implementations use all three betting stages (PRE-FLOP / POST-FLOP / TURN) — this is an operator configuration choice. See F014 for multi-stage betting and F032 for operator configuration.

Technical Design

State representation

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

All hole cards for all hands are face-up at the hole stage (and remain so). This matches the JS reference client which reveals all cards via 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: all hole cards (all hands) are face-up (HEDGE-135)
  • 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() returns false at river and does not increment dealStatus beyond 3
  • isGameOver is true only at dealStatus === 3
  • resolveBets() is called exactly once, after the river advance

Version Parity


Known Discrepancies

None documented yet.

Test Coverage

Playwright spec: tests/features/F004-game-stages.spec.ts — AC1–AC6, all passing for UMA (2026-04-15). Run with VERSION=uma npx playwright test tests/features/F004-game-stages.spec.ts --project=features --workers=1 Existing partial coverage in standalone_reference_client/tests/e2e/smoke.spec.ts:
  • screenshot: full game cycle — deal → flop → turn → river — covers stage transitions visually
  • betting: full cycle — asserts dealStatus === 3 and gameOver === true at river
Unit test coverage in standalone_reference_client/tests/unit/GameEngine.test.ts:
  • advances to hole (0) on first advance()
  • advances through all four stages
  • returns false from advance() when already at river
  • isGameOver is true at river