F006 — Odds Calculation
| Field | Value |
|---|---|
| ID | F006 |
| Phase | 1 — Core Game Engine |
| Jira | HEDGE-133 |
| Status | TS ⬜ · JS ⬜ · UMA ⬜ |
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:| Step | Calculation | Result |
|---|---|---|
| Win probability | 25% | 0.25 |
| European odds | 1 / 0.25 | 4.00 |
| House margin | 3% | 0.03 |
| Payout odds | 4.00 × (1 − 0.03) | 3.88 |
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:HedgeEmJavaScriptClient/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 fromcoredata.ts (generated from JS game records). The oddsRounded field in HandStageInfo is used directly.
- 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):
| Field | Type | Description |
|---|---|---|
percentWin | number | Raw win probability (0–1) |
percentDraw | number | Draw probability |
percentWinOrDraw | number | Win + draw combined |
oddsActual | number | 1 / percentWinOrDraw before margin |
oddsRounded | number | Post-margin, post-rounding value shown to player |
Acceptance Criteria
| # | Criterion | JS | TS | UMA |
|---|---|---|---|---|
| AC1 | oddsActual = 1 / percentWinOrDraw for all hands at all stages | ⬜ | ⬜ | ⬜ |
| AC2 | oddsRounded reflects margin-adjusted and rounded value | ⬜ | ⬜ | ⬜ |
| AC3 | Odds displayed to player match oddsRounded at bet time | ⬜ | ✅ | ⬜ |
| AC4 | Odds update correctly at each stage transition | ⬜ | ✅ | ⬜ |
| AC5 | Dead hands display 0 odds | ⬜ | ✅ | ⬜ |
Version Parity
| Version | Status | Notes |
|---|---|---|
| JS (reference) | ⬜ Not audited | Odds pre-computed server-side; client reads from game record |
| TS | ⬜ Not audited | Reads oddsRounded from coredata; no client-side calculation |
| UMA | ⬜ Not audited | Phase 5 |
Related Features
- F007 — RTP Margin (the
houseMarginparameter) - F033 — Rounding Algorithms (post-margin rounding of
oddsActual → oddsRounded) - F015 — Payout Calculation (uses
oddsAtBetcaptured fromoddsRounded)
