Work is sending me to a conference that just happens to be hosted in Las Vegas, a city where there are a few casinos. I’m not much for gambling, so I figured I should learn a little about it before I even think of doing such a thing. I read that craps is a fun game that has some pretty safe bets, so I decided to learn more about that. To that end, I wrote a craps simulator.
To get it up and running, make sure you have PHP and Composer installed, and do the following:?
git clone git@github.com:dmuth/craps-simulator.git
cd craps-simulator/
composer installer
Syntax is explained in the README.md file, but just by running the file main.php, you can run games of craps and see what the results are. The simulator allows you to place “Pass” and “Take Odds on the Point” bets. Multiple players with different starting balances, bet amounts, and betting/exit strategies can also be simulated.
A successful run will look something like this:
Note that if you simulate enough games, you will lose all of your money. That’s the whole point of how casinos work, actually. Use my simulator to see how it works instead of playing a few dozen games and finding out for yourself.
The source code can be found over here: https://github.com/dmuth/craps-simulator