1; the optimizer modifies these weights without changing the underlying simulation outcomes.
How it works
The algorithm uses iterative weighted sampling:- Generate trial distributions — candidate sets of weights are drawn using Gaussian sampling, with optional scaling applied to specific win ranges.
- Evaluate against targets — each candidate distribution is scored against the configured RTP and hit-rate targets per win-type condition.
- Accept viable distributions — distributions that fall within the mean-to-median bounds (volatility controls) are retained.
- Rank and select — retained distributions are ranked by running simulated test spins, and the best-scoring distribution is written out as the final lookup table.
Rust implementation
The algorithm is implemented in Rust for performance. It compiles to a binary executable. The source lives inoptimization_program/src/main.rs.
You only need to rebuild the binary the first time you set up the project, or after modifying
optimization_program/src/main.rs. For routine optimization runs the pre-built binary is used automatically by OptimizationExecution.optimization_program/ directory, or let the Python wrapper invoke it via cargo run --release.
Lookup tables and weights
Each row in a lookup table CSV has the form:1, meaning all simulations are equally likely to be selected. After optimization the weights are rewritten to lookUpTable_<mode>_0.csv, reflecting the probability mass the optimizer assigned to each simulation.
Key inputs
Key outputs
Conditions and simulation assignment
Theconditions dictionary partitions simulations into exclusive groups — one group per win type (for example, wincap, freegame, 0, basegame). The optimizer reads these entries in order and assigns matching simulation IDs to each condition, removing them from the available pool before moving to the next.
Example conditions ordering
wincap is listed before freegame because every wincap simulation also triggers the freegame; listing it first ensures it is assigned to the wincap bucket rather than the freegame bucket.
Next steps
Setting up optimization
Configure
OptimizationSetup and run the optimizer from run.py.Game analysis
Generate a PAR sheet and analyze the optimized win distribution.
