Skip to main content

F020 — Deal Button / Auto-deal on Load

FieldValue
IDF020
Phase3 — UI
JiraHEDGE-134
StatusTS ✅ fixed · JS ✅ verified · UMA ⬜

Business Rule

The game must start at the hole stage immediately on load — hole cards face-up, community cards face-down, hand odds visible, betting UI active. No player action is required to initiate the first deal. After river is resolved, a DEAL button appears so the player can start the next game. The DEAL button is hidden at all other times.

JavaScript Reference

JS Source: HedgeEmJavaScriptClient/odobo/src/js/control.js
// control.js:15 — called once at game launch
function InitialiseGame() {
    SetCreditAmount(CREDIT_INIT_VALUE);
    SetWinAmountTitle(false);
    SetWinAmount(0);
    InitialiseDealData();
    AdvanceGameState();   // ← auto-runs all CC_AUTO_ADVANCE states to CC_ALLOW_BETS_1
    gameInitialised = true;
}
AdvanceGameState() loops through:
CC_GAME_INIT → CC_GAME_START → CC_DEAL_CARD1 … CC_DEAL_CARD13 → CC_ALLOW_BETS_1
All states up to CC_ALLOW_BETS_1 are CC_AUTO_ADVANCE — they run without player input. The loop stops at CC_ALLOW_BETS_1 which is CC_AWAIT_INPUT (hole betting window). JS Live: hedgeem.qeetoto.com — loads directly at hole stage.

Between games (JS)

After river resolution the JS state machine auto-advances:
CC_ADD_WIN → CC_CYCLE_HANDS → CC_SHOW_HAND1…4 → CC_GAME_END → CC_GAME_START → [re-deal]
The next game starts automatically with no player action. There is no explicit DEAL button in JS — the green advance button triggers each stage transition.

TypeScript Implementation

File: standalone_reference_client/src/scenes/GameScene.ts

Fix applied (HEDGE-134)

Added this._onDeal() call at the end of GameScene.create():
// Auto-deal on load — JS reference starts at hole stage immediately (control.js:InitialiseGame).
// HEDGE-134
this._onDeal();
_onDeal() handles:
  1. Hides DEAL button
  2. Loads local game (engine.loadLocalGame())
  3. Advances to hole (engine.advance() → dealStatus=0)
  4. Renders the hole stage
  5. Shows advance button

Between games (TS — design difference)

Unlike JS (fully automatic), TS shows the DEAL button after river so the player explicitly starts the next game. This is a deliberate UX difference — considered acceptable for v5.

Acceptance Criteria

#CriterionJSTSUMA
AC1Page load shows hole stage — cards dealt, odds visible
AC2DEAL button hidden on initial loadN/A
AC3DEAL button appears after river resolvedN/A
AC4Playwright confirms dealStatus === 0 without player interaction

Version Parity

VersionStatusNotes
JS (reference)✅ VerifiedAuto-deals via InitialiseGame()AdvanceGameState()
TS✅ Fixed_onDeal() called from create() — HEDGE-134
UMA⬜ Not auditedPhase 5

Test Coverage

TestLocation
Auto-deal on loadtests/features/F020-deal-button.spec.ts (to add)
Smoke — page loads at hole stagestandalone_reference_client/tests/e2e/smoke.spec.ts