June 2019
Beginner to intermediate
770 pages
19h 24m
English
The difficulty that we sometimes have with top-level script configuration is the lack of handy default values. To provide defaults, we can use ordinary class inheritance. Here's how we can use the class definition to build an object with the configuration values:
class Example2(simulation.AppConfig): dealer_rule = Hit17() split_rule = NoReSplitAces() table = Table( decks=6, limit=50, dealer=dealer_rule, split=split_rule, payout=(3, 2) ) player_rule = SomeStrategy() betting_rule = Flat() player = Player(play=player_rule, betting=betting_rule, max_rounds=100, init_stake=50) outputfile = Path.cwd()/"data"/"ch14_simulation2b.dat" samples = 100
This allows us to define the AppConfig class with default configuration ...
Read now
Unlock full access