skent259 / crapssim

Simulator for craps with various betting strategies
MIT License
28 stars 13 forks source link

What are craps-test.py and run_simulations.py in the Python directory for? #8

Closed amortization closed 5 months ago

amortization commented 2 years ago

It looks like craps-test.py might just be some pre unit testing smoke tests, so I would think that this could be removed or refactored and moved to the test directory.

run_simulations.py looks like convenience methods to run simulations without having to set up the tables and players etc. I think that these would be good to have somewhere so maybe they can be refined and moved into crapssim?

skent259 commented 2 years ago

craps-test.py is exactly as you say. It can be removed with the new testing

I'm not sure what to do with the helper functions in run_simulations.py. I'm not sure if they add value to the package or confuse it. Ideally it would be nice to have a place for specific run methods for certain simulations, but there's so many ways to do it that it might be counterproductive to add to crapssim. Thoughts?

amortization commented 2 years ago

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, ...]
amortization commented 2 years ago

For now I added a Pull Request to dev (#9) to just remove that directory.

amortization commented 2 years ago

How about Craps.Rproj? Can that be removed as well?

skent259 commented 2 years ago

Craps.Rproj can be removed (ideally through the .gitignore file). It dates back to when this directory contained some R tools for visualization, but it makes more sense for them to be separate.

I really like the idea of some simulation methods that are consistent and well documented. Since this is a larger issue, I've added it separately in issue #14