Skip to main content

F006 — Odds Calculation

FieldValue
IDF006
Phase1 — Core Game Engine
JiraHEDGE-133
StatusTS ⬜ · 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:
europeanOdds = 1 / percentWin
payoutOdds   = europeanOdds × (1 - houseMargin)
Worked example (from game concept document):
StepCalculationResult
Win probability25%0.25
European odds1 / 0.254.00
House margin3%0.03
Payout odds4.00 × (1 − 0.03)3.88
If the player bets £1 and the hand wins, they receive £3.88. Over four statistically fair plays (one win):
RTP = payout / (bets × stake) = 3.88 / (4 × 1.00) = 0.97 = 97%
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: 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 from coredata.ts (generated from JS game records). The oddsRounded field in HandStageInfo is used directly.
// GameEngine.ts
getHandOdds(hand: number): number {
    const info = this._infoAt(hand);
    return info?.oddsRounded ?? 0;  // pre-calculated, server-generated
}
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):
FieldTypeDescription
percentWinnumberRaw win probability (0–1)
percentDrawnumberDraw probability
percentWinOrDrawnumberWin + draw combined
oddsActualnumber1 / percentWinOrDraw before margin
oddsRoundednumberPost-margin, post-rounding value shown to player

Acceptance Criteria

#CriterionJSTSUMA
AC1oddsActual = 1 / percentWinOrDraw for all hands at all stages
AC2oddsRounded reflects margin-adjusted and rounded value
AC3Odds displayed to player match oddsRounded at bet time
AC4Odds update correctly at each stage transition
AC5Dead hands display 0 odds

Version Parity

VersionStatusNotes
JS (reference)⬜ Not auditedOdds pre-computed server-side; client reads from game record
TS⬜ Not auditedReads oddsRounded from coredata; no client-side calculation
UMA⬜ Not auditedPhase 5
  • F007 — RTP Margin (the houseMargin parameter)
  • F033 — Rounding Algorithms (post-margin rounding of oddsActual → oddsRounded)
  • F015 — Payout Calculation (uses oddsAtBet captured from oddsRounded)