Skip to content

Add methods for running simulations #14

@skent259

Description

@skent259

I like the idea of having some convenience methods for running the simulations, and maybe even some convenience methods for simplifying the data through displaying with charts or giving helpful aggregation data (I'm a gambler not a statistician but for me average ROI, risk of ruin, coin-in, etc. could be valuable.)

Might make sense to have that as a separate package or something within crapssim, but I think that as long as it's well documented it could just be available in crapssim itself.

I think that this would be useful on the users end for simplicity, and allow us to add more features for running those simulations. For example, one thing that I would like to see on that front would be using the tqdm package to allow us to show a progress bar of the simulation completion status. I would think most end users would find this helpful, but it would be burdensome to document how to set that up in the readme for a user who just wants to run a simulation on their strategy. Similarly, I haven't tested it yet but I think that there could be some significant speed increases if when running multi simulations we utilized the multiprocessing module.

In theory, I think that one way to do it might be a Simulation object where you could add the table(s) and player(s) and a run method that would then run and store the results. Maybe with classmethods or optional arguments to initialize it for table, player, strategy, etc. For example to run 1000 passline simulations:

sim = Simulation.from_strategy(strategy=passline, bankroll=10000, runout=True)
sim.run(count=1000)

then it would show a tqdm progress bar with x number of simulations over 1000 being completed. And then there would be methods or properties with data ex:

print(sim.win_loss_amounts)
>>> [100.4, -55.6, 4000, ...]

Originally posted by @amortization in #8 (comment)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions