In this post we will simulate two different betting tactics for the game of roulette. A martingale is a system of bet that gives the player an advantage that ensures gains.
Of course a working martingale does not exists in casino games but a lot of people still believe that the double bet on lost tactics work.
Let’s find out.
The roulette is a random game where the player places a bet on a number or a color on the roulette table. When the bets are set, the casino rolls a ball in the roulette. Once the ball landed, the bank pays the players that have the appropriate bets. In order to simplify, we will only use color bets. There are 18 red numbers and 18 black numbers. The 0 has no color and is the bank advantage. If the player wins it gains 2 times its bet. If he loses, the casino keeps his bet.
Simulating the game
Simulating a game is quite easy. If the player only plays colors, it has 18 on 37 chances to win. Which is of course less than 50% of chance (48.6%).
We can simulate a roulette result like this:
def playRoulette(): if random.randint(0,36) <= 19: return False else: return True
The average player, most of the time bet the same amount of money. He has a target and starting funds. If he reaches its target, he leaves the table.
It is possible to simulate him like that:
def classicPlayer(funds,fundstarget,bet,maxrounds): curround=0 x =  y =  while curround<maxrounds: curround+=1 if playRoulette(): funds+=bet else: funds-=bet x.append(curround) y.append(funds) if fundsfundstarget: break plt.plot(x,y) return funds results= for i in range(1,200): results.append(classicPlayer(1000,3000,50,50)) plt.show() plt.hist(results, 20, facecolor='green', alpha=0.75) sum(results)/len(results)
The code can be run in an python notebook and yields the following results for this set of parameters:
- 200 players
- 50 bets
- 1000 $ of founds
- 3000 $ as target
- 50 $ for each bet
This graph shows the funds value of all the players for the 50 rounds. The luckiest player ended up with 1750$ and a few players lost all their funds. The average final fund is: 840 $. And the histogram of gains is shown below:
It means that most players will still be alive at the end of their 50 turns.
The martingale player thinks that a smart way to play would be to double its bet after each loss. Note that most casinos will limit the maximum/minimum bet per table.
So we need to add this limitation in our martingale player that we can simulate like that:
def doublePlayer(funds,fundstarget,bet,maxbet,maxrounds): curround=0 x =  y =  while curround<maxrounds: curround+=1 if playRoulette(): funds+=bet else: funds-=bet if bet*2<maxbet: bet=bet*2 x.append(curround) y.append(funds) if fundsfundstarget: break plt.plot(x,y) return funds results= for i in range(1,200): results.append(doublePlayer(1000,10000,50,500,50)) plt.show() plt.hist(results, 10, facecolor='green', alpha=0.75) sum(results)/len(results)
We introduced the “maxbet” value in order to simulate the casino bet limit. Here are the results for players with similar starting values compared to our classic player with a maximum bet limit of 500 $.
We have now a lot of losers without money and a lot of winners that reached the 3000 $ target.
On average the gain is: 612 $ so worse than the classic player
The histogram of gains is shown below:
As expected the two tactics don’t work. However, if you want to ensure that you will still have money at the end of the day, use the classic betting rule. If you want to have a chance to triple your funds use the martingale tactic. Of course, tuning the parameters will slightly change the conclusion.
The full code of the note book is accessible here.