Problem: Martingale Roulette Strategy

The gambler wins the stake if the roulette comes up RED and loses otherwise. The strategy that the gambler has in mind is to double the bet after every loss, so that the first win would recover all previous losses plus win a profit equal to the original stake. Can this strategy help the gambler win?

Recall that the roulette has 37 slots: 18 red, 18 black and 1 green.

Code

knitr::opts_chunk$set(echo = TRUE)

S=50;            # stake for each bet
N=10000;          # number of repetitions
res=rep(0,N);    # overall stake used in each repetition
nplays=rep(0,N); # overall stake used in each repetition

for (n in 1:N)
{
  # n-th repetition
  k=0; # number of play for each repetition
  M=0; 
  while(TRUE)
  {
    k=k+1;
  
    # update the overall stake
    M=M+S*2^(k-1);

    # if we win, exit the loop
    if( runif(1)<18/37 ){break;} # OR, e.g., if( sample(x=c(0,1), 1, prob=c(18,19) ) < 1 ){break;}
  }
  res[n]=M;
  nplays[n]=k;
}

#print(res);
#print(nplays);

means=cumsum(res)/c(1:N);
plot(means);