Skip to main content

F033 — Rounding Algorithms

FieldValue
IDF033
Phase4 — Configuration
JiraTBD — create from HEDGE-133
StatusTS ⬜ · JS ⬜ · UMA ⬜

Business Rule

A Rounding Algorithm converts the precise computed payout odds (oddsActual) into a player-friendly rounded value (oddsRounded). Rounding is optional — enabled or disabled by the operator at installation. Example:
oddsActualRounding modeoddsRounded
3.71Integer3
3.711 decimal place3.7
3.88Integer3
3.881 decimal place3.9
2.9781 decimal place2.9 (as seen in coredata)
RTP impact: Rounding down (the typical direction for player-friendly presentation) reduces actual RTP below target. This is expected and operator-accepted. Rounding mode selection is part of how the operator balances presentation quality against precise RTP targeting.

Source: Game Concept Document

“In Texas Hedge’Em context a ‘Rounding Algorithm’ is the term given to rounding the payout-odds presented to a player to an integer or whole-number-fraction. For example, instead of presenting odds of 3.71:1 the player would be presented odds of 3:1. Rounding Algorithms are optional and enabled or disabled at installation.”
“The target RTP is set by the operator at installation time but the actual RTP can be influenced by other configuration parameters such as ‘Rounding Algorithms’.”

Evidence in Coredata

The coredata (ported from JS game records) shows both oddsActual and oddsRounded per hand per stage:
// game-engine/F001 example from coredata.ts
{ oddsActual: 2.978, oddsRounded: 2.9, ... }  // 1 d.p. rounding
{ oddsActual: 7.6965, oddsRounded: 7, ... }    // integer rounding
{ oddsActual: 3.0204, oddsRounded: 3, ... }    // integer rounding
The current coredata appears to use a mix of integer and 1 d.p. rounding. The precise algorithm used to generate this data is not yet documented.

Rounding Modes (to be confirmed)

ModeDescriptionExample
IntegerRound to nearest whole number3.71 → 4 or 3
Integer (floor)Always round down3.71 → 3
1 decimal placeRound to 1 d.p.3.71 → 3.7
Whole-number fractionRound to nearest 0.5 step3.71 → 3.5
The exact algorithm(s) used in the JS reference implementation require server-side code audit.

TypeScript Implementation

Current status: oddsRounded is consumed directly from pre-computed coredata. No rounding is performed client-side. The oddsRounded field already contains the rounded value. Display in GameScene.ts (HEDGE-86 — suppress trailing .0):
const odds = info.oddsRounded;
const oddsStr = Number.isInteger(odds) ? `x${odds}` : `x${odds.toFixed(1)}`;
Full rounding algorithm implementation will be needed for live data generation.

Acceptance Criteria

#CriterionJSTSUMA
AC1oddsRounded derived from oddsActual via configured algorithmN/A
AC2Integer rounding mode: oddsRounded is a whole number
AC3Displayed odds match oddsRounded, not oddsActual
AC4Rounding can be disabled (display oddsActual directly)
AC5Trailing .0 suppressed in display (x5, not x5.0)N/A

Version Parity

VersionStatusNotes
JS (reference)⬜ Not auditedRounding applied server-side; client reads odds_rounded
TS⬜ PartialReads pre-rounded values; display formatting ✅ (HEDGE-86)
UMA⬜ Not auditedPhase 5
  • F006 — Odds Calculation (oddsActual is the input to this algorithm)
  • F007 — RTP Margin (margin applied before rounding)
  • F024 — Odds Display (UI display of oddsRounded)
  • F032 — RTP Config (operator enables/disables rounding at installation)