Simulating Roulette Strategies in R

Sukhdeep Sedha
The Startup
Published in
7 min readSep 15, 2020

This article is a beginner level exercise in introductory concepts of probability and simulation design. Lets have some fun with R while learning.

The problem statement is as follows…

At the Crown Casino in Melbourne, Australia, some roulette wheels have 18 slots colored red, 18 slots colored black, and 1 slot (numbered 0) colored green. The red and black slots are also numbered from 1 to 36. (Note that some of the roulette wheels also have a double zero, also colored green, which nearly doubles the house percentage.)

You can play various ‘games’ or ‘systems’ in roulette. Four possible games are:

  1. Betting on Red: This game involves just one bet. You bet $1 on red. If the ball lands on red you win $1, otherwise, you lose.
  2. Betting on a Number: This game involves just one bet. You bet $1 on a particular number, say 17; if the ball lands on that number you win $35, otherwise you lose.
  3. Martingale System: In this game, you start by betting $1 on red. If you lose, you double your previous bet; if you win, you bet $1 again. You continue to play until you have won $10, or the bet exceeds $100.
  4. Labouchere System: In this game you start with the list of numbers (1, 2, 3, 4). You bet the sum of the first and last numbers on red (initially $5). If you win you delete the first and last numbers from the list (so if you win your first bet it becomes (2,3)), otherwise you add the sum to the end of your list (so if you lose your first bet it becomes (1, 2, 3, 4, 5)). You repeat this process until your list is empty, or the bet exceeds $100. If only one number is left on the list, you bet that number.

Different games offer different playing experiences; for example, some allow you to win more often than you lose, some let you play longer, some cost more to play, and some risk greater losses. The aim of this article is to compare the four systems on the following criteria:

  1. The expected winnings per game
  2. The proportion of games you win
  3. The expected playing time per game, measured by the number of bets made
  4. The maximum amount you can lose/win

Lets look at the betting systems…

System 1 — Betting on Red: This kind of an event is called a ‘Bernoulli Trial’, referring to the definition from Wikipedia

In the theory of probability and statistics, a Bernoulli trial is a random experiment with exactly two possible outcomes, “success” and “failure”, in which the probability of success is the same every time the experiment is conducted.

In this case, winning is defined as an event where the ball lands on any slot with red color.

Part 1: Let's calculate the theoretical probability for the amount won when this system is incorporated to play the game.

Where 18/37 is the probability of winning, 19/37 is the probability of losing (we lose if ball lands in any of the 18 black slots and 1 green slot), $1 and -$1 are the amount gained in a scenario of a win/loss respectively.

PS: Negative dollar indicates money lost when you loose the bet.

This means you lose ($0.027) every time you play. (surprise, surprise) This also shows us that if you play the game long enough, you are bound to loose money at the Casino. That’s why Stat Major should refrain from gambling.

Simulation design process: Idea here is to play this virtually 100000 times and check if our theoretical results match with the experiment and check other interesting facts about betting this way.

Simulation Design Objectives :

  1. Design a function which plays the roulette game (ODDS of winning18/37)
  2. Play this game 100000 times and return the amount won
  3. Sum these winnings from the simulated games.

Simulation results for System 1:

Mean of amount won after 100000 trials: -0.02642 (Code in appendix)

Comparing the theoretical results vs experimental results:

Percentage of error=2.14%

This means our experiment stands corrected, if we play this game long enough we see the mean of total amount won converges towards the theoretically proposed value.

Part 2: Proportion of wins: Number wins for this game will be theoretically equal to

Simulation estimate for 100000 trials: 0.48651 (Code in appendix)

Percentage error = -0.0061%

Part 3: Expected playing time = 1 bet (game only lasts 1 bet as per description in question statement)

Part 4: Maximum money player can lose/win = $1 (By game design) This system will only last 1 cycle.

Let's look at Betting system 2 (Betting on a number)

Key difference in this scenario, you only win the game if the ball lands on the number you bet on. This means 1/37 chance of winning a game (you can place bets on any number expect 0)

The amount won also changes to $35 that means if you bet on number 7 and ball lands on it, your original bet of $1 yields winnings of $35 dollars.

If you guys are still with me the below calculation should be intuitive:

Part 1: Let’s calculate the theoretical probability for the amount won when this game is played

Where 1/37 is the probability of winning, $35 amount won, 36/37 is the probability of losing,-$1 is the money lost.

Simulation results for mean amount won after 100000 trials = -0.0265

Percentage error = 1.85%

Part 2: Proportion of wins: Theoretically the proportion of winning can be given by

Simulation results for number of games won after 100000 trials: 0.02584 (Percentage error 4.296%)

Part 3: Playing time is 1 bet

Part 4: Max amount which can be lost is $1

Part 5: Max amount which can be won is $35

Lets look at betting system 3, Martingale betting.

Recall that In this system of you start by betting $1 on red. If you lose, you double your previous bet; if you win, you bet $1 again. You continue to play until you have won $10, or the bet exceeds $100.

We have introduced some system constraint to mimic real life situation i.e no one has infinite money and second there are actual betting caps in casinos limiting the maximum amount any player can bet, to discourage mis-use of this strategy.

We don’t have a theoretical expectation of the amount won so let’s look at the results from simulation

Part 1: Mean amount won during simulation of 100000 trials = -$1.82907

Part 2: Proportion of wins = 0.9138 (This means you have 91.38% chance of winning a game if you use this strategy!!!!)

Part 3: Expected playing time by simulation = 16 (1 game lasts 16 consecutive bets on average)

Part 4: Maximum amount player can lose = $127

Consecutive losses starts -1 -2 -4 -8 -16 -32 -64 = -$127 (Bad luck hits harder)

Part 5: Maximum amount won: $10 (by design as an exit case scenario, in real life we can change this to any amount which a player might feel confident about and stop betting after achieving that goal)

Lets look at the final betting technique Labouchere betting system

Recall that, In this game you start with the list of numbers (1, 2, 3, 4). You bet the sum of the first and last numbers on red (initially $5). If you win you delete the first and last numbers from the list (so if you win your first bet it becomes (2,3)), otherwise you add the sum to the end of your list (so if you lose your first bet it becomes (1, 2, 3, 4, 5)). You repeat this process until your list is empty, or the bet exceeds $100. If only one number is left on the list, you bet that number.

Looks a bit complicated but simple strategy, who might use it you ask…no idea! But let’s explore the statistical idea behind the process

Part 1: Mean amount won as per simulation of 100000 = $-3.32318

Part 2: Proportion of wins by simulation = 0.95636 or 95.636% (And you thought 91% in Martingale was as high we can go? This system increases our proportion by an additional 4%)

Part 3: Expected playing time by simulation = 4 (Average game lasts 4 consecutive bets)

Part 4: Maximum amount of money player can lose = $4940

Consecutive loses since start -5 -6 -7 -8…..- 99 = -$4940

Part 5: Maximum amount of money player can earn =$10

Some graphs to put all the numbers into perspective

Amount lost per game: tableau link

Here its evident money lost per game is higher in labouchere and martingale

Proportion of winning a game: Tableau link

Labochere and martingale have a higher a proportion on winning a roulette game

Standard deviation of amount lost: Tableau link

Labouchere system is the most variable when it comes to what the outcome might look like

Playing time for 1 game (Consecutive bets): Tableau link

Labouchere’s playtime is most variable whereas martingale seems to take most number of consecutive bets on average per game

So to conclude, you still lose money even if you manage to win individual bets in a roulette game if you play long enough the house is the only one standing….

Simulation Code: https://github.com/sedhasukhdeep/Roulette-Simulation

--

--