Fast Jack's Floating Hall of Craps


The roulette table pays nobody except him that keeps it. Nevertheless a passion for gaming is common, though a passion for keeping roulette tables is unknown.

--George Bernard Shaw

Fast Jack here. Ever since I was a boy, I've loved the game of craps. Specifically, I've loved running games of craps. In high school I wrote a craps game for the TI-82 calculator that was blindingly fast. It was so fast, my classmates took to calling me Fast Jack.

(Actually, they called me Fast Jack because I was on the track team, but that makes a lousy story.)

Craps is a friendly game. As with all games of chance, if you play long enough you'll lose all your money, but it happens slowly enough that you stay on good terms with the fellow running the game (eg. myself). As I matured, I became fascinated with this aspect of the game. I became determined to discover exactly what the odds were of winning any particular game of craps.

That's why I wrote this Python simulation. It will play many, many games of craps (far more than I could hope to play with you face-to-face) and analyze the results. Enjoy!

Number of games (1-10000)

The Rules

The rules are simplicity itself (themselves?). You roll two dice. If the sum is a 2,3, or 12, you lose. If the sum is a 7 or an 11, you win. Otherwise, you make note of the sum and keep rolling the dice until you get a 7 (in which case you lose) or the number you initially rolled (in which case you win). Most games are over in one or two rounds, but a game can go on for arbitrarily many rounds.

The Source

I believe in running an honest game. That's why I support the open source movement. The CGI, The Simulation object, and the CrapsGame object are all avaliable for your perusal.

Leonard's Notes

I don't know how intuitive the table printed out by the CGI is; it's basically taken verbatim from a C++ program I wrote in 1996. That program was also the birthplace of the character of Fast Jack. If you think you can do a better stats table, be my guest.

One thing I'd like to add to this program is the ability to play around with the rules of craps (eg. you win or lose on different numbers); stay tuned.

I did write a craps program for the TI-82 when I was in high school. It wasn't particularily fast, though.


This document (source) is part of Crummy, the webspace of Leonard Richardson (contact information). It was last modified on Saturday, August 18 2007, 03:10:23 Nowhere Standard Time and last built on Monday, April 21 2014, 07:03:11 Nowhere Standard Time.

Crummy is © 1996-2014 Leonard Richardson. Unless otherwise noted, all text licensed under a Creative Commons License.

Document tree:

http://www.crummy.com/
features/
hall/
craps/
Site Search: