I love craps. It's social, it's interactive, it's intense, and (when played well) it's your best bet at the casino.

First of all, this is how I play craps: I start with a minimum pass line bet (usually $5). I don't change that bet until a point is set, then once the point is set, I take odds on that. If its 6 or 8 I take 5x odds ($25), if its any other number I take 2x odds ($10). I then put out a minimum come bet ($5). Same idea here, if it craps out I replace the bet until a number is set, and I take odds on that come bet using the same rules as a pass bet. I keep doing come bets with odds until either the player craps out or I have every number covered. At this point, I'll put out one final come bet, and as long as the player keeps rolling numbers, I keep going "off and on", and I never have to put any more money down. If I'm up a good amount I may expidite the process by placing $12 on 6 and 8 after the come out roll. This is riskier but it lets me get up my odds on 6 and 8 quicker and cheaper. I may also throw out some hard ways if I have singles that I want to get rid of.

This strategy is a modified "1-2-3 strategy". A common way to play is to take 1x odds on 4 and 10, 2x odds on 5 and 9, and 3x odds on 6 and 8, and do that for 2 or 3 come bets. This is my version of that.

My strategy is good because you've got lots of number coverage on the board and you're hedged a little bit against a 7 because of the come bet. However, it can be bad because of how much money is on the table at once. For instance if the player rolled every number on the board once and then rolled a 7, I wouldn't have won a single dollar and the 7 would have cost me $120. What this means in short terms is that I either lose a lot fast or win a lot fast.

Anyway, I recently decided I wanted to refine my strategy a bit. I could use straight math to find the best strategy ( in fact many people have already done that). However what I realized was two things: first, some strategies are just not fun to play. And second, I don't play endlessly. The mathematic edge that the house has on you is theoretical given an infinite number of games. I however only play for an hour at a time usually. So I wanted to know how much I would typically win/lose when only playing for an hour at a time.

This is where my programming skills come into play. I decided to write a craps simulator. First I came up with some quick requirements of what I wanted to accomplish...
So the first two are fairly self explanitory. But to accomplish the third requirement I'd need to do some research. After a bit of browsing I decided on LUA. Using the standard Boost library you get a lot of out-of-the-box options for scripting (python, perl, etc). But, I've done those before, and I like LUA. I used it to code WoW add-ons a while back, and from what I understand it's not terribly difficult to integrate LUA with C++ even without it being integrated to Boost. Especially with tools like LuaBind.

I start with the basics, I design it all OOO. A game object to hold state, a dealer object to pay out and take down bets, and a player to make bets. Fairly soon I have a working game. I throw up a quick project page so that I can send it to friends and get feedback.

And I'm done. Now to try out some strategies. I'll post some updates later with what I find.