My brother turns 21 in a couple of weeks and my parents and I are taking him to Las Vegas. For my 21st, I brought $200 to gamble in Vegas and came home with around $450, mostly from playing craps. I plan on bringing $200 again for this trip and before I go I thought I'd run some craps simulations to see if I can double my money again.
I've read from several sources that the house has the smallest advantage in craps when placing a passline bet with maximum odds. From my memory, and as surveyed by Wizard of Odds, most casinos on the Strip are 3-4-5 odds with a $5 minimum. Taking this into account, here is a simulation of a craps session (of 100 dice rolls) in PHP:
<?php
$stash = 200;
$bet = 5;
for($i=100; $i--;) {
$dice1 = mt_rand(1, 6);
$dice2 = mt_rand(1, 6);
$total = $dice1 + $dice2;
if(!$button) {
if($total===7 || $total===11) {
$stash += $bet;
}
elseif($total===2 || $total===3 || $total===12) {
$stash -= $bet;
}
else {
$button = $total;
if($total===4 || $total===10) {
$odds = $bet*3;
}
elseif($total===5 || $total===9) {
$odds = $bet*4;
}
elseif($total===6 || $total===8) {
$odds = $bet*5;
}
}
}
else {
if($total===7) {
$button = 0;
$stash -= ($bet + $odds);
}
elseif($total===$button) {
$button = 0;
$stash += $bet;
if($total===4 || $total===10) {
$stash += $odds*2/1;
}
elseif($total===5 || $total===9) {
$stash += $odds*3/2;
}
elseif($total===6 || $total===8) {
$stash += $odds*6/5;
}
}
}
echo 'Stash: $'.$stash.'<br/>';
}
?>
Is there anything wrong with my math here? While there are peaks and troughs throughout each session, this simulation more often doubles its money before going broke. Considering the house always has the edge in craps, even if it's just a fraction of a percent, I'm perplexed by this result.
I'd be careful with any piece of code written to "prove" you're more likely to double your money at craps (or any other game of chance) before you go broke. Las Vegas is a sprawling city in the desert of Nevada as a testament to two things:
There is no game any casino would put on their floor that didn't leverage both rules. If your code disagrees with Vegas, I'm putting my money on Vegas.
Update:
Here is some C++ I wrote based on your original code. The original problem you posted was if you could double your money before you went broke more often than not. I followed up the code I wrote with some results.
Results:
You're not checking to see if you have enough left in the stash to place your desired odds bet. In fact, you're not checking the size of your stash at all. It's unsurprising that this simulation will be able to beat the house more often if you are able to bet even if your stash size is negative.
By the way, I ran 50,000 iterations of your simulation of 100 dice throws (with my modification of maximum bet of stash remaining) and came up with the following:
wins: 23807
losses: 25465
push (you leave with $200): 728
avg. winnings: $109.07
Well, right off the bat, I can see that you've got an error in the simple 7 or 11 win case: You're supposed to win your bet, not twice your bet.
Edit: I believe the payout for the odds bet is commensurate with the actual probability. You are twice as likely to roll 7 (lose your odds) than 10, so you should get paid 2:1 when you win on a 4 or 10; and only paid 6:5 when you win on a 6 or 8.