Skip to content

Utilities

Various useful functions

Game analytics

The run function within run_analysis.py is a helper function for analyzing optimized win-distributions. Note: This program assumes a specific format for optimized game lookup tables, as generated by the provided optimization algorithm. Additionally, automatic generation of hit-rates and simulation counts assumes the existence of a force_record_<mode>.json file, where wins have been recorded with the keys:

'symbol': '<name>',
'kind' : '<num_symbols_in_win>'

For example within the Lines class we record wins with the format:

def record_line(kind: int, symbol: str, mult: int, gametype: str) -> None:
    """Force file description for line-win."""
    gamestate.record({"kind": kind, "symbol": symbol, "mult": mult, "gametype": gametype})

A .xlsx file is produced detailing the hit-rates, RTP contributions and number of simulations recorded within of pre-defined win-ranges. Assuming that the gametype is recorded, hit-rates for game-types matched to BetMode.criteria inputs. This allows for visualizing if win-ranges are occurring in or out of the feature game. This is particularly useful when setting scale_factor values within the GameOptimization.scaling class.

Valid symbol names are extracted from the GameConfig.paytable component. Using recorded kind and symbol elements, hit-rates, simulation counts and average payout multiplier amounts for a given simulation are generated.

Custom search keys can be passed to the run() function, providing the hit-rates for specific events within the gamestate.record() function.

Analysis

Once a lookup table has been optimized it is often useful to analyze the resulting win-distribution, which is a dictionary where the keys are all ordered, unique payouts and the values represent the probability of obtaining this specific payout value.

Misc

Swap lookups

The optimization algorithm outputs several viable lookup tables with the <game>/library/optimization_files/ folder. This file provides functions for swapping out weights in the <game>/library/lookup_tables/lookUpTable_<mode>_0.csv file/.

Get file hash

Helper functions for printing the SHA256 values of a single file or all non-python files within a directory to console. These values can be compared with SHA values with config.json files to check if file contents have been altered.