Skip to main content

F006 — Odds Calculation

Business Rule

For each hand at each betting stage, the game calculates the payout odds the player will receive if they bet on that hand and it wins. The calculation converts the raw win probability into European (decimal) odds, then subtracts the operator-configured RTP margin. Formula:
Worked example (from game concept document): If the player bets £1 and the hand wins, they receive £3.88. Over four statistically fair plays (one win):
The odds presented to the player may be further rounded to player-friendly values by the Rounding Algorithm (see F033).

Source: 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.”
“Texas Hedge’Em has a very simple maths model that is derived from the direct probability of an outcome occurring and a margin that the operator configures to take from each bet.”

JavaScript Reference

JS Source: hedgeem-v4/odobo/src/js/ (not yet located — audit required) The JS client receives pre-calculated odds_actual and odds_rounded from the server-generated game records. The odds calculation is performed server-side (C# server / Node server) at game generation time, not in the client. The client only displays and uses the pre-calculated values. odds_actual = raw computed payout odds (e.g. 3.88) odds_rounded = rounded value after Rounding Algorithm (e.g. 3.9 or 3) — see F033

TypeScript Implementation

Current status: The TS standalone_reference_client does not calculate odds — it reads pre-computed values from coredata.ts (generated from JS game records). The oddsRounded field in HandStageInfo is used directly.
Full odds calculation will be needed for:
  • Live API integration (F031) when the TS client connects to a Node/C# server
  • Any server-side TS implementation

Data Structure

HandStageInfo (from types.ts):

Rounding Algorithm

The HedgeEm Rounding Algorithm (computeOddsChain in api/_lib/utils.js) operates on a percentage scale (0–100, not 0–1):
The oddsRounded value is what the player sees and bets at. All displayed odds are affected by this rounding — the rounding itself creates a small additional rake (roundingRake).

Theoretical Odds Ranges by Stage

Ranges depend on hand count and the poker evaluator’s combination count. Using unordered board combinations (standard for hold’em probability): Note: 46 × 45 = 2,070 is the permutation count for 2 cards from 46 (TURN remaining in a 1-hand game). The combination count (standard) is C(46,2) = 1,035.

Acceptance Criteria

UMA-testable ACs (via state bridge)

The UMA client exposes pre-computed odds via window._holeOdds (at HOLE) and window._lastStages[i][last].multiplier (after each advance). Raw winPercentage / oddsActual require the debug extension (not yet enabled — see below).

Debug extension (not yet enabled)

To verify AC1/AC2 (formula correctness), platform.js needs to expose raw values:
  • Add oddsActual: chain.oddsActual to buildHandOdds() return in advance.ts
  • Add window._rawOdds per stage in platform.js (mapping winPercentage, drawPercentage, oddsActual)

Version Parity

Test Coverage

Playwright spec: tests/features/F006-odds-calculation.spec.ts — AC1–AC5 (UMA). Run with:
  • F007 — RTP Margin (the houseMargin parameter)
  • F033 — Rounding Algorithms (post-margin rounding of oddsActual → oddsRounded)
  • F015 — Payout Calculation (uses oddsAtBet captured from oddsRounded)