October 21

3 comments

How to Win at Roulette Using Monte Carlo Simulation

In this post I’ll put forward how to statistically win at roulette with a reasonable amount of success. This doesn’t mean you wont lose, you will just win with a higher degree of probability.

The Monte Carlo method is used to run multiple simulations of playing the strategy. We can then look at summary statistics on all the simulations to figure out how successful the strategy was.

Running summary statistics on all the simulations is a good way of optimising variables. Because different values for variables can be compared with each other to determine optimum values.

This is a relatively long post. It is worth the read if the technical and statistical bits interest you. But if it doesn’t, you can just skip to the end where the optimum strategy is presented.

Roulette

Much has been written about the game >>link to Wikipedia<< so it’s not worth going into too much detail. Overall it involves placing a bet on where a ball falls on a wheel. There are 38 possibilities of which you can bet on 36. There are a range of betting options. These go from general, where you can bet on a colour (black or red) or an individual number. There are other ways too that are described in the Wikipedia article.

Depending on the odds of your bet you will get a return. For instance if you bet on red, the likelihood is slightly less than even odds. This means you will win as much as you bet. If you bet on an individual number, you will win 36 times you bet.

The odds are against you

The fact that you can’t bet on two numbers which aren’t considered in calculating the odds, means the game is slightly stacked against you. So the best way to win at roulette is not to play. If you are playing, then it is best to use a strategy and stick to it.

The Strategy

The Martingale System has been around for ages. Probably even before Martingale lay claim to it. There’s nothing special or mind blowing about it. It’s just something that we can statistically test by running simulations on it.

  1. Place a small bet with even odds (i.e. you have the same (similar) chance of winning as you do losing. This could either be on black or red, odds and evens, low or high (1-18, 20-36).
  2. If you win keep the winnings and run the same bet again.
  3. If you lose, double the bet. If you keep losing double your bet until you win. At which point keep the winnings and the process resets with the initial small bet again.

You are betting on how unlikely it is to have a continuous losing streak.

Why does it work?

The basis of this strategy is to quit while you’re ahead. It’s a plan for maximising wins while minimising losses. For example 7 goes at the wheel looks like below. You stop when you make it and you continue playing long enough when you don’t.

There is of course that one instance when you blow the bank, but you’re playing on the likelihood of this not happening. Even though highly unlikely that you will have a losing streak of 7 consecutive goes, it is not impossible.

You will lose more at roulette without a system

Vegas was built on people’s inability to know themselves or think statistically. Your brain doesn’t deal with some numbers very well.

  1. The odds of winning. The casino always has an edge. The expected value of any bet it always less than 0 this mean that if you play for long enough, you will lose.
  2. The inability to think statistically. Logical brain vs intuitive brain. The Monty Hall problem is another gambling problem that doesn’t make intuitive sense but has a statistical “right” solution.
  3. The gamblers fallacy aka the Monte Carlo fallacy aka the fallacy of the maturity of chances. We have a tendency to believe we are due a particular result if it hasn’t come up for some time. For instance in a series of coin tosses if we see consecutive heads we think we are “due” a tails. Statistics doesn’t work like this because each coin toss has the same probability as the past one.
  4. Your emotions work against you. Unless you’re a professional gambler, you’re probably going to go through a whole range of emotions while you’re playing. This clouds your judgement and leads you to take unnecessary risks or quit at the wrong time.

Assumptions and Stuff

A successful strategy is getting a positive outcome more times than a negative one when running the simulation. A strategy is deemed successful in this case if its expected value (ev) is positive and unsuccessful if it is negative. A strategy with a higher expected value is assumed to be better than one with a lower one.

Each of the variables are looked at in isolation and the best selected for expected value. The variables may not be the best together. An optimisation function can be created but this will take a long time to compute.

Python will give you quasi random variables. This means unlike real world random numbers they are not statistically independent. You can do things like generate random numbers that fit a normal distribution. There are no such things as perfectly random variables in the real world. If you gather enough variables you will be able to see a bias. Real life roulette wheels may give you some groups of numbers more than others.

Some things you need to look out for

  1. A bank of any size can be wiped out by consecutive losses. Bank here means the amount you bring to the table.
  2. There should be a large spread between the bank and original bet. There is a 0.5% chance of 7 consecutive losses but even if the original bet was only 1% of the bank, the entire bank would be gone at that point.
  3. Because of the above, an original bet of 0.7% of your bank will allow you to weather 7 consecutive losses.

This is not a recommendation. I haven’t tried this strategy nor do I hope to. There is no “skin in the game” for this one. It’s a bad idea to take advice from someone with no skin in the game or doesn’t share your downside.

With that out of the way …

Let’s go to Vegas!

The next section is how the code is set up. All the code and graphs can be found in the associated Github repository.

Create the Universe

Martin (Martingale), has $100 in the bank and is ready to go. His strategy is to use the Martingale system with his initial bet being $1.

The roulette table is happy to accommodate.

Because you can’t form a hypothesis on 1 player, we will have to use an army and average out the results.

The Setup

All that the code does is collate statistics on interactions between the player and the game.

The Game

A list of all possible outcomes on the wheel. Every turn will pull out a random choice.

The Player

Has a wallet full of money and a plan. The player has a number of variables he plays with.

  • bank – The amount he starts off with
  • start – value of original bet

The player can leave the game at 3 points:

  1. He blows the bank.
  2. He finishes a fixed number of plays.
  3. He gets the bank up to a particular point.

This set of variables will be the strategy the player always plays.

The Simulation

Would be using these variables to run a simulation of many times.

Expected Value (EV)

(Percentage Wins * Average Won) – (Percentage Losses) * (Size of Bank)

EV is a way of comparing strategies with different variables.

Once we have this all set up, we can optimise variables to figure out which has the best values.

Optimising Variables

This area looks at each of the variables and runs simulations looking at different values. They are smoothed and plotted out to see if different values give better outcomes.

Bank Size

You need to have a big enough buffer for when things go wrong and they will. This is a function is a factor of how big your initial bet is vs the amount in the bank. Betting around 0.7% of your bank per bet means that you can have 7 consecutive losses before blowing the bank. Although this is very unlikely, it is the worst case scenario and it does happen a number of times in the simulation.

The bigger the bank the fewer the times you blow your account. But this also brings down the average winnings in the simulation as the amount of money you lose when you blow the bank increases. In terms of expected value, there seems to be a sweet spot around the $140 mark of the bank size from a starting bet of $1. This could be because at this kitty size you can withstand 7 consecutive losses. So if your bank is x, your starting bet should be x * 0.7%

Number of Goes

The number of goes are the number of times a player will bet during a session. There is a practical limitation on the number of goes a player can have. If it takes 5 mins per spin, 100 spins can take a whole 8 hour night.

The graph below indicates that the more goes you have the better. The Expected Value seems to flatten over the 125 mark, but for practical reasons we will keep this around 100 spins.

The more you play, the more your wins go down (on average) this is because the house always wins and there is a small built in bias favouring the house in the game. The same applies to the number of times you blow your kitty. The more you play, the greater the chances.

The strategy seems to work because even though this is the case, the average winnings value seems to go up.

Cashing Out Early

The variable Till is the percentage of your bank you need to win back before you cash out. This could happen before you’ve reached your number of goes so you stop early.

Some of the code has 999 as a value of till. This means the player always runs until broke or the number of goes is completed.

From the graph it looks like a good idea to cash out at 50% of the kitty. This will also save the number of goes.

Running with Optimised Numbers

It looks like the strategy works so using the optimised numbers we can run summary statistics on a group of simulations. We will look at the ev values here. Arbitrarily running a 1000 simulations for team sizes of 1000.

  Variable      Value
---------------------
      Bank        100
     Start          1
      Goes        100
      Till         50

Summary

If you don’t want to read the technical bits, the analysis of what to do is summarised below. If you want to know how these were derived, then please proceed to the explanation.

  1. It pays to leave after you have made 50% of your kitty rather than finish off the number of goes that you planned to do when you started. This is because the return evens off around the 50% of your kitty.
  2. Your initial bet should be around 0.7% of what you have in your kitty. For example, if you bring in $140 to the table, your initial bet and the bet you reset to after a loss should be $1.
  3. Unless you blow the bank, there is a good chance you will make 50% of your kitty if you continue playing. The kitty is large enough to weather and extraordinarily bad string of luck.
  4. You should play for around 90 goes. That’s about 7.5 hours of constant gambling or till you reach 50% of your kitty. These are the optimum values for these variables.

How simulations like these can help business

This kind of modelling is a useful tool for business. If you have a system and components within that system that are predictable, then models like this will be able to model how it will operate given a certain set of conditions.

If you have come to the end of this post then thank you for reading. I hope you found this post interesting. Please get in touch if you want to discuss this further in the comments section. You may have spotted an error or have a different approach. Either way it could make for interesting discussion.

References

All the code of this simulation as well as the graphics can be found in the Github repository here.


Tags

Forecasting


You may also like

  • Excellent post and write up!

    How could this approach be applied to something like Cryptocurrency trading? I was once told by a friend to look at Markov Chain Monte Carlo in relation to trading Bitcoin, but for the life of me haven't been able to make sense of it. Since price fluctuations can be so dramatic, does it make sense to build in constraints to the trading model in terms of upper and lower ends? Would love to see a post on that if you ever get a chance. Thanks!

    • Hi Sheran, thanks for the reply. With Monte Carlo simulation, you model the next event based on a completely random sample. With Markov Chains, the next event models some information from the existing event. This gives it a smaller number of possible predictions.

      A good analogy between Monte Carlo and Markov chains is when constructing random sentences word by word. With Monte Carlo the output would just be a bunch of random words, but with a Markov Chain, each subsequent word would depend on the previous word, giving a smaller number of possible predictions. It would automatically follow a syntax because some words naturally follow others and some do not.

      For Stock trading, it will look at how prices moved in the past and the distribution will tell you how it is likely to move in the future. It’s not very good with things like Cryptocurrency because it is hard to model dramatic price movements. We like assets that are well behaved and predictable.

      Hope this helps.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

    If you like to know more about posts like these or have a query about financial modelling

    >