TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/StakeEngine/math-sdk/llms.txt
Use this file to discover all available pages before exploring further.
WinManager class is the single source of truth for all win amounts during a simulation run. It separates wins across four distinct tracking levels and provides methods to update each level at the appropriate point in game logic.
Access the manager via self.win_manager on any GameState instance.
Initialization
String identifier for the base game type (e.g.
"basegame"). Must match gametype values used in update_gametype_wins().String identifier for the free game type (e.g.
"freegame").Win cap value. Applied when accumulating end-of-round totals in
update_end_round_wins().Win tracking levels
The four levels map to different scopes within a simulation run:1. spin_win — current reveal
Win amount for the current reveal event. Reset for each new spin within a freegame.
Current reveal win. Updated by
update_spinwin().win_amount to both spin_win and running_bet_win.
spin_win to an exact value rather than incrementing. Adjusts running_bet_win by the difference. Useful for end-of-sequence win modifications such as applying a win cap.
spin_win to 0.0. Called at the start of each reveal.
2. running_bet_win — cumulative for one simulation
Cumulative win across all reveals and gametypes within a single simulation run. Automatically updated whenever update_spinwin() or set_spin_win() is called — no explicit call needed.
Running total for the current simulation. The final value must equal the simulation’s
payout_multiplier.3. basegame_wins / freegame_wins — per-gametype
Per-gametype win totals for the current simulation. Reset at the start of each new run_spin() call.
Accumulated wins attributed to the base game for this simulation.
Accumulated wins attributed to the free game for this simulation.
spin_win to either basegame_wins or freegame_wins depending on gametype. Raises RuntimeError if gametype does not match either configured mode.
4. Cumulative simulation wins
Total wins across all simulation runs for this bet mode. Updated automatically byimprint_wins() after each accepted simulation.
Sum of capped wins from all simulations (base + free).
Cumulative base game wins across all simulations.
Cumulative free game wins across all simulations.
basegame_wins and freegame_wins to cumulative totals. Win cap (max_allowed_win) is applied per gametype. Called automatically inside imprint_wins() — do not call directly.
basegame_wins, freegame_wins, running_bet_win, spin_win, and tumble_win to 0.0. Called at the start of each simulation.
Additional properties
Tracks cumulative wins across a sequence of tumble/cascade events within a single reveal. Useful for win-banner updates or applying end-of-sequence multipliers.
Typical usage pattern
A complete base game spin using line wins:update_spinwin() is called once per tumble step, accumulating across the cascade:
