I'm making a roulette system simulator, specifically right now the Martingale roulette system. So what I do know about the system that there is an Anti-Martingale too, which is the same, but you have to double the bet at every win. So let's only take a look at the red bets:
The function looks like this:
public void Red(List<int> red, int random)
{
if (anti == false)
{
if (red.Contains(random)) // reds: 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36
{
money -= currentPot;
money += currentPot * 2;
currentPot = startPot;
}
else // if it's black or null
{
money -= currentPot;
currentPot *= 2;
}
}
else // double at win
{
if(red.Contains(random))
{
money -= currentPot;
money += currentPot * 2;
currentPot *= 2;
}
else
{
money -= currentPot;
currentPot = startPot;
}
}
}
the anti variable holds if it's anti or normal martingale, random is the spinned number.
So I have an output file, after 10 spins it looks like this:
money, startPot, currentPot, spinnedNumber
900, 100, 100, -
800, 100, 200, BLACK
1000, 100, 100, RED
900, 100, 200, BLACK
700, 100, 400, BLACK
1100, 100, 100, RED
1000, 100, 200, BLACK
800, 100, 400, BLACK
1200, 100, 100, RED
1300, 100, 100, RED
1200, 100, 200, NULL
My question is: Does the Martingale system make always profit or there's something wrong with my code? I know every casino has an edge, but if there's no edge, it will always be profitable after a certain number of spins.
If you have infinite money and decide to stop doubling your bet and reset after each time you win, then your expected total profits will increase without bound with probability 1, in the limit as you keep playing more and more rounds. However, if you start with a FINITE amount of money, then the chances of losing everything eventually and going broke make it so that your expected winnings after any number of rounds, no matter what your betting system, will always be zero (if there's just red and black) or negative (if there's red and black and green 0 and 00 and you lose on black or green). This is the essence of a martingale.