Martingale

Betting Strategy Simulation

The Martingale Betting Strategy (Wikipedia Article) is based on the idea that with payouts of 1 to 1, there is a good chance that you can recover lost bets when you achieve a win. The strategy has been used in roulette, where the probability of winning on red and black is close to 50%.

In general, the strategy is to double a bet whenever you lose in the hopes that the color you lost on will eventually come back around and you'll recover your loss. For example, if you bet $1 on black and lose, you would then place $2 on black the next time. If black wins on the next spin, you recover your lost $1 and gain $1. If black loses again, you double the $2 and make a $4 bet. If you win this time, you've recovered the $1 + $2 you've spent and collect a $1 gain. If you lose again, you double the bet to $8. And so on. Again, the idea being that black will eventually come around and, so long as you keep doubling the bet, you'll eventually recover your losses while earning a $1 gain whenever you don't lose. There are 38 slots on an American roulette wheel: 18 black, 18 red, and 2 green. The probability of hitting a black or red on any single spin is 47.37%.

The bane of this system is the inevitable streaks of a particular color. Doubled bets increase exponentially. A $1 bet doubled 10 times becomes a whopping $1024 ($2, $4, $8, $16, $32, $64, $128, $256, $512, $1024)! In theory, if you have an infinite bank roll, you would always recover your losses because black always does come back round eventually. In practice, the upper limit is the table's max bet and the money you bring to the table. You may not have a chance to recover your losses before exceeding the table limit on doubled bets.

Probability tells us that eventually we'll either lose our bank roll or hit the table max bet. This simulation was written to visually represent how long one might go before hitting that wall.

For this simulation we will run up to 100,000 spins on a roulette wheel with bets using a modified version of the classic Martingale Strategy.

This simulation assumes the conditions of the standard video roulette machines I played in Vegas casinos. $3 minimum bet. $1000 maximum bet. I'm going to give it a bank roll of $1000 just to be generous. The max number of spins will be 100,000 (provided we don't bust or exceed the table limits before reaching it). To achieve the minimum bet, we'll start with $1 on red and $2 on black and double the bet on a losing color, while placing $1 on the winning color. Betting $1 on the opposing color is the only deviation from the classic Martingale Strategy, which only calls for doubling losing bets. However, this is both necessary to achieve the minimum bet of $3 total and also what you ought to do anyway. You have a 47.37% chance of recovering your loss by winning a doubled bet. However, in the absense of that, you will necessarily gain $1 unless it lands on green (a 5.26% chance). I maintain this is an improvement on the classic Martingale.

Jeremy Parnell

To verify the conditions of this simulation our Roulette Wheel class is open source.

using System;

namespace JeremyParnell.Simulations
{
	public class Wheel
	{
		// These are fixed slots on the wheel. -1 is a placeholder for "00" which is handled below.

		public static int[] slots = new int[] {
			0,28,9,26,30,11,7,20,32,17,5,22,34,15,3,24,36,13,1,-1,27,10,25,29,12,8,19,31,18,6,21,33,16,4,23,35,14,2
		};

		// Define our RNG.

		private Random random;

		public Wheel()
		{
			// Set up our RNG.

			// Because the sequence of randomly selected slots is deterministic to 
			// an instance seed, we want to ensure that each simulation runs with a 
			// different seed so that the sequence for the simulation is also random.

			this.random = new Random(Guid.NewGuid().GetHashCode());
		}

		private string SlotNumber(int slot)
		{
			// Since -1 is actually "00" on our wheel, here we handle that.

			if (slots[slot] >= 0)
				return slots[slot].ToString();
			else
				return "00";
		}

		private string SlotColor(int slot)
		{
			// Here we determine what color the number should be.

			int number = slots[slot];

			if (number > 0)
			{
				//Number ranges 1-10 and 19-28, odd numbers are Red and even are Black.
				//Number ranges 11-18 and 29-36, odd numbers are Black and even are Red.

				if ((number <= 10) || (number >= 19 && number <= 28))
				{
					return (number % 2 == 0) ? "Black" : "Red";
				}
				else
					return (number % 2 == 0) ? "Red" : "Black";
			}
			else
			{
				//0 and 00 are Green.

				return "Green";
			}
		}

		public Results Spin()
		{
			// Here we pick the actual random slot.

			int slot = random.Next(slots.Length);

			// Here we construct the results of the spin.

			Results results = new Results();
			results.Color = SlotColor(slot);
			results.Number = SlotNumber(slot);

			return results;
		}
	}

	public class Results
	{
		// Class for defining Results.

		private string _color;
		public string Color
		{
			get { return _color; }
			set { _color = value; }
		}

		private string _number;
		public string Number
		{
			get { return _number; }
			set { _number = value; }
		}

		public Results()
		{

		}
	}
}