Smith is in jail with 1 dollar and 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 0.4 and loses A dollars with probability 0.6.
Smith bets 1 dollar each time. The probability of reaching 8 dollars before losing all his money
z <- 1 # Smith's starting amount
M <- 8 # Target amount to win
q <- 0.6 # Probability of losing a bet
p <- 0.4 # Probability of winning a bet
if (p != q) {
qz <- ((q/p)^z - 1) / ((q/p)^M - 1)
} else {
qz <- z / M
}
qz
## [1] 0.02030135
start_dollars <- 1
out_jail <- c()
for (j in 1:100000) {
samples <- c(start_dollars)
for (x in 1:100) {
samples <- append(samples, sample(c(1,-1), size=1, replace=T, prob=c(.4,.6)))
if (sum(samples) >= 8){
out_jail <- append(out_jail, 1)
break
} else if (sum(samples) <= 0) {
break
}
}
}
sum(out_jail) / 100000
## [1] 0.01974
Smith bets as much as possible but not more than necessary to reach 8 dollars.
p1_bold <- 0.4^3
cat("Probability with bold strategy:", p1_bold)
## Probability with bold strategy: 0.064
start_dollars <- 1
out_jail <- c()
for (j in 1:100000) {
samples <- c(start_dollars)
for (x in 1:100) {
samples <- append(samples, sample(c(sum(samples),-sum(samples)), size=1, replace=T, prob=c(.4,.6)))
if (sum(samples) >= 8){
out_jail <- append(out_jail, 1)
break
} else if (sum(samples) <= 0) {
break
}
}
}
sum(out_jail) / 100000
## [1] 0.06419
The strategy with a higher probability \(p_1\) gives Smith a better chance of
getting out of jail.
Probability with timid strategy : 0.02
Probability with bold strategy: 0.064,
Therefore bold strategy gives a smith a better chance.