- Notifications
You must be signed in to change notification settings - Fork19
Simulator for craps with various betting strategies
License
skent259/crapssim
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
When playing craps in a casino, there are unlimited combinations of ways that that players can place their bets. But, with this freedom comes complexity, and players deserve to know how a strategy could perform in each session. The 'crapssim' package is designed answer these tough questions: What's a fun strategy involving multiple numbers where the house edge doesn't increase too much? What's the best amount of passline or don't pass odds for my bankroll? Does hedging my bet improve my net winnings?
Crapssim is a python package which runs all of the necessary elements of a Craps table. The package follows some natural logic:
- a
Table
hasPlayer
(s) andDice
on it - the
Player
(s) haveBet
(s) on theTable
- each
Player
'sStrategy
can automatically set upBet
(s)
With these building blocks, crapssim supports
- running1 session with1 player/strategy to test a realistic day at the craps table,
- runningmany sessions with1 player/strategy to understand how a strategy performs in the long term, or
- runningmany sessions withmany players/strategies to simulate how they compare to each other
These powerful options can lead to some unique analysis of the game of craps, such as the following figure comparing 4 strategies with a budget of $200:
To see how a single session might play out for you using a pass line bet with double odds, over 20 rolls, one might run:
importcrapssimascrapsfromcrapssim.strategyimportBetPassLine,PassLineOddsMultipliertable=craps.Table()your_strat=BetPassLine(5)+PassLineOddsMultiplier(2)table.add_player(strategy=your_strat)table.run(max_rolls=20,verbose=True)
To evaluate a couple of strategies across many table sessions, you can run:
importcrapssimascrapsn_sim=20bankroll=300strategies= {"place68":craps.strategy.examples.PassLinePlace68(5),"ironcross":craps.strategy.examples.IronCross(5),}foriinrange(n_sim):table=craps.Table()forsinstrategies:table.add_player(bankroll,strategy=strategies[s],name=s)table.run(max_rolls=float("inf"),max_shooter=10,verbose=False)forpintable.players:print(f"{i},{p.name},{p.bankroll},{bankroll},{table.dice.n_rolls}")
For more advanced strategies, you can either write your own customStrategy
class or add strategy components together. To see the many possibilities, start with the tutorials on documentation site:
For a normal user, it is recommended to install the official release. You willneed an installation of python version 3.10 or newer. Then, run the followingcode in your terminal:
pipinstallcrapssim
Development installation instructions arealso available.
Some results from this simulator have been posted tohttp://pages.stat.wisc.edu/~kent/blog:
- One Surprising Feature of Dark Side Betting
- 5 Systems to Try at the Craps Table
- Craps: Best Strategies on a Budget
- All Bets Are Off: Re-learning the Pass Line Bet in Craps
If you discover something interesting using this simulator, please let me know so that I can highlight those results here. You can find me atskent259@gmail.com.
Those looking to contribute to this project are welcome to do so. Currently, the top priority is to improve
About
Simulator for craps with various betting strategies