Here is a simulation of a gambler's ruin process.
(Updated: see the new scalable version.)
This applet simulates a gambler who repeatedly bets $10, until he either
loses by going broke, or wins by doubling his initial fortune.
The applet accepts the following keyboard inputs. (You may need to
"click" on the applet first.)
Use the numbers '0' through '9' to set the animation speed level higher
Use 'r' to restart the simulation, or 'z' to zero the Win/Loss counts.
Use '>' and '<' to increase/decrease the win probability of each bet.
(Possible values include 0.492929 [the probability of winning at craps]
and 0.473684 [the probability of winning at roulette] plus various other
values like 0.333333, 0.4, 0.45, 0.49, 0.495, 0.499, 0.4999, and 0.5.)
Use '+' and '-' to increase/decrease the initial fortune
by $10 (and restart).
Or, use 'H' or 'G' or 'F' to set the initial fortune to
$100 or $1000 or $5000, respectively.
- Use 'A' to jump to $10 ahead of bankruptcy,
or 'B' to jump to $10 behind victory.
The probability of victory in this "gambler's ruin" game is known to be
[((1-p)/p)^(Init/10) - 1] /
[((1-p)/p)^(Init/5) - 1]
(where p is the win probability of each individual bet,
and Init is the initial fortune),
which is very small if p < 0.5 and Init is large.
[If p = 0.5 then this formula does not apply; in that case
the probability is of course 0.5.]
Applet by Jeffrey S. Rosenthal
[Return to my Applets Page / Home Page]