Skip to main content
The 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

str
required
String identifier for the base game type (e.g. "basegame"). Must match gametype values used in update_gametype_wins().
str
required
String identifier for the free game type (e.g. "freegame").
float
required
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.
float
Current reveal win. Updated by update_spinwin().
Adds win_amount to both spin_win and running_bet_win.
Sets 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.
Resets 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.
float
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.
float
Accumulated wins attributed to the base game for this simulation.
float
Accumulated wins attributed to the free game for this simulation.
Adds spin_win to either basegame_wins or freegame_wins depending on gametype. Raises RuntimeError if gametype does not match either configured mode.
As part of final payout verification, self.final_win must equal basegame_wins + freegame_wins. A mismatch raises a RuntimeError. Always call update_gametype_wins() at the correct point in game logic.

4. Cumulative simulation wins

Total wins across all simulation runs for this bet mode. Updated automatically by imprint_wins() after each accepted simulation.
float
Sum of capped wins from all simulations (base + free).
float
Cumulative base game wins across all simulations.
float
Cumulative free game wins across all simulations.
Adds capped 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.
Resets basegame_wins, freegame_wins, running_bet_win, spin_win, and tumble_win to 0.0. Called at the start of each simulation.

Additional properties

float
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:
For a tumbling game, update_spinwin() is called once per tumble step, accumulating across the cascade: