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
p <- 0.4
q <- 1-p
j <- 1
N <- 8
P <- (1-(q/p)^j) / (1-(q/p)^N)
P
## [1] 0.02030135
r <- 10000
w <- 0
for (i in 1:r){
j <- 1
while (j > 0 & j < N){
if(runif(1) <= p){
j <- j + j
}else{
j <- j-j
}
}
if(j >= N){
w <- w + 1
}
}
w/r
## [1] 0.0616
The Bold strategy will give smith a better chance to get out of jail.