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:

(a) he bets 1 dollar each time (timid strategy).

Gambler’s Ruin Formula:

\[ P = \frac{1-(\frac{q}{p})^{x}}{1-(\frac{q}{p})^{y}} \]

\[ P = \frac{1-(\frac{.6}{.4})^{1}}{1-(\frac{.6}{.4})^{8}} = 0.02030135 \]

current_amount <- 1
out_on_bail <- 8
win_prob <- .4
lose_prob <- .6

(1-(lose_prob/win_prob)^current_amount) / (1-(lose_prob/win_prob)^out_on_bail)
## [1] 0.02030135

(b) he bets, each time, as much as possible but not more than necessary to bring his fortune up to 8 dollars (bold strategy).

# 3 is the number of times Smith would bet to reach 8 dollars if he wins without losing
z <- 3 
# raise win percentage to the number of times Smith would bet to reach 8 dollars
win_prob^z
## [1] 0.064

(c) Which strategy gives Smith the better chance of getting out of jail?

The Timid strategy would give Smith approximately a 2% chance to get out of jail, while the Bold strategy would give him a 6.4% chance of getting out of jail. Therefore, Smith should use the Bold strategy.