Skip to main content

F015 — Payout Calculation

Business Rule

At river, the game resolves all bets:
  • Winning hand only: bets on losing hands and dead hands contribute £0
  • Locked-in odds: oddsAtBet is the oddsRounded value at the moment the bet was placed, not the river odds
  • All stages included: hole, flop, and turn bets on the winner all pay out
  • Credits: credits = (initialCredits − totalBet) + payout at end of round

Worked Example (from Game Concept Document)

“If a hand has a 25% chance of winning this is first converted to European odds (4:1) then a house margin is subtracted of (say) 3% so odds become 3.88:1. If the player bets £1 on the hand and it wins they will receive £3.88 payout. If the player has four successive bets of same value statistically only one will win; thus in this case RTP = payout/bet = 3.88/4 = 0.97.”
The stake (£1.00) is deducted from credits at bet placement. On win, £3.88 is added — net gain £2.88.

JavaScript Reference

JS Source: hedgeem-v4/odobo/src/js/hands.js
GetHandOdds(hand, stage) returns the locked-in odds for that hand at that betting stage — non-zero only for the winning hand; 0 for losing and dead hands. This is why the JS loop over all hands naturally produces 0 for non-winners without an explicit winner check. GetHandBet(hand, stage) returns the bet placed on that hand at that stage (0 if no bet). Credit deduction and award (control.js):
Note: JS deducts credits in a single batch at CC_DEDUCT_BETS (after all betting). TS deducts per-bet immediately in placeBet(). Both produce the same net credit result.

TypeScript Implementation

File: standalone_reference_client/src/engine/GameEngine.ts
isHandWinner(hand) reads statusIsWinner from the game record at dealStatus=3 (river).

Bug fixed (HEDGE-136)

The previous implementation paid ALL bets regardless of hand outcome. Winning-hand filter was missing.

Acceptance Criteria

Version Parity

Test Coverage