skent259 / crapssim

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

Table can run forever if player's bankroll is greater than zero, but less than bet unit. #5

Closed amortization closed 2 years ago

amortization commented 2 years ago

The stopping condition for the table is

https://github.com/skent259/crapssim/blob/a75b997f8f3603b952bfc7e838e519c259dcbc83/crapssim/table.py#L116-L128

so if a player has a bankroll > 0, but it's less than their strategies bet unit the simulation will run longer than it should since the player is no longer able to bet. If we move the unit to the player we can do

https://github.com/amortization/crapssim/blob/cd1fcc001273feb1d66022d584f470d8f9eb251e/crapssim/table.py#L121-L133

which would check whether or not the player has enough units to continue betting. Or if we want to leave the old logic in place as well (although I don't think it's a good simulation that someone would sit and watch rolls and not bet) we could add a flag to the player or table like we do with runout that would allow either option.

amortization commented 2 years ago

This is fixed with #3 being merged to dev.