Skip to main content
The Stake Engine Math SDK provides four win evaluation methods. You select one by setting config.win_type in your GameConfig, then call the corresponding function from within run_spin() or run_freespin(). All four methods return the same win_data structure, so wallet manager updates and event emission are consistent regardless of which method you use.

The win_data structure

Every win evaluation function returns:
The positions key is required for the predefined win event functions to correctly adjust row numbers when padding symbols are in use.

Multiplier strategies

All win methods integrate with apply_mult() from src.wins.multiplier_strategy. Three strategies are available: Pass the strategy when calling the win function:
The resulting meta dict includes multiplier, winWithoutMult, globalMult, and lineMultiplier (for lines) or symbolMult and ways (for ways), giving the frontend full detail to display the win breakdown.

Lines wins

Lines games pay on fixed paylines. Each payline is an array of row indices — one per reel — that defines a path across the board.

Paylines configuration

Define paylines in config.paylines as a dict from line index to row array:
game_config.py

Calling get_lines()

gamestate.py

Wild substitution

Wilds substitute for any non-wild symbol. When a payline begins with one or more wilds followed by a non-wild symbol, the engine evaluates both the wild-only win and the substituted win, taking whichever pays more:
  • Payline [W, W, W, L4, L4] evaluates (3, "W") vs (5, "L4") and keeps the higher payout.
Wilds on the first reel do not trigger substitution — only wild-then-symbol sequences from left to right are evaluated. A common approach is to define wild symbols to pay only for complete lines (e.g. 5-of-a-kind wilds only), avoiding ambiguous comparisons.

Lines meta fields

Choosing a win type

Lines

Fixed paylines on a rectangular grid. Best for traditional slot formats with a defined number of win paths.

Ways

All combinations across consecutive reels. Higher hit-rate than lines on the same board size.

Cluster

Adjacent symbol groups. Common with tumble mechanics and large, irregular boards.

Scatter

Total symbol count anywhere on board. Pairs naturally with cascading grids and high symbol counts.

Game Configuration

Set win_type and configure the paytable for your chosen method.

Game Events

Emit win events after calling a win evaluation function.

Lines API reference

Full Lines class method reference.

Ways API reference

Full Ways class method reference.