Skip to main content
Every position on self.board holds a Symbol instance. Symbols are lightweight objects created from a shared SymbolDefinition (via SymbolStorage), so definition data is not duplicated across the board.

Class hierarchy

Symbol

Properties

str
Shorthand symbol name (e.g. "H1", "W", "S"). Read from the SymbolDefinition.
bool
True if the symbol name appears in any config.special_symbols group.
set[str]
Set of all special attribute names assigned to this symbol (e.g. {"wild"}, {"scatter", "multiplier"}).
bool
Set to True by win evaluation functions (cluster, scatter) to mark this position for removal during a tumble.
int | None
Multiplier value. None unless the symbol has the "multiplier" special flag or assign_attribute() is called.

Methods

symbol.check_attribute(*attrs)

Returns True if any of the given attribute names exist on the symbol with a value that is not None or False.

symbol.get_attribute(attr)

Returns the value of the named attribute via getattr. The attribute must exist on the symbol instance.

symbol.assign_attribute(attribute_dict)

Sets one or more attributes on the symbol instance at runtime.

SymbolDefinition

The shared definition object for a symbol name. Created once per unique name at SymbolStorage init time.
str
Symbol name string.
set[str]
All special attribute keys this symbol belongs to, derived from config.special_symbols.
bool
True if special_flags is non-empty.
bool
True if the symbol name appears as a value in config.paytable.
list | None
List of {str(kind): payout} dicts for this symbol. None if not paying.

SymbolStorage

Created once during GameState initialization. Holds one SymbolDefinition per unique symbol name. Provides the create_symbol() factory method used by Board.
Instantiates a fresh Symbol from the stored SymbolDefinition. Raises ValueError if name is not registered:

Special symbols configuration

config.special_symbols maps attribute names to lists of symbol names:
A symbol can belong to multiple attribute groups. When a Symbol is initialized, all matching flags are set via assign_default_attribute():

Special symbol functions

To assign dynamic attribute values at symbol creation time, override assign_special_sym_function() in the GameStateOverride class:
Any callable listed in special_symbol_functions[name] is called with the new Symbol instance immediately after creation in Board.create_symbol().
Symbol __slots__ is a fixed list. You cannot add attributes not defined in __slots__ at runtime. If your game requires a new attribute (e.g. prize), it must already be declared in the Symbol class.