Question:

Smith is in jail and has 1 dollar; he can get out on bail if he has 8 dollars. A guard agrees to make a series of bets with him. If Smith bets A dollars,he wins A dollars with probability .4 and loses A dollars with probability .6. Find the probability that he wins 8 dollars before losing all of his money if

  1. he bets 1 dollar each time (timid strategy).
  2. he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).
  3. Which strategy gives Smith the better chance of getting out of jail?

Answer:

Given:

has <- 1
need <- 8
win_probability <- 0.4
lose_probability <- 0.6
ratio <- lose_probability/win_probability
sum <- 0
count <- 0
for(i in has:need){
  cat(sprintf("At(%s) = %f \n", c(i), (1-ratio^i)/(1-ratio^need)))
  sum <- sum + (1-ratio^i)/(1-ratio^need)
  if(i==1)
    p1 <- (1-ratio^i)/(1-ratio^need)
  count <- count + 1
}
## At(1) = 0.020301 
## At(2) = 0.050753 
## At(3) = 0.096431 
## At(4) = 0.164948 
## At(5) = 0.267724 
## At(6) = 0.421887 
## At(7) = 0.653132 
## At(8) = 1.000000
  1. Timid strategy
    P(1) = 0.0203013

  2. Bold strategy
  1. P(Bold strategy) > P(Timid strategy) => Bold strategy is preferred.