Gambler's Ruin

Click on the Simulate button to simulate one game. See the instructions here.


Instructions

This applet show the Gambler's Ruin.

The Gambler's Ruin is a probability concept where a player play a series of games against an adversary (who have an unlimited bank, i.e. the bank cannot go broke). However, the player can go broke, which will happen when the score is 0 (zero). The series of games ends when the player either has won the target gain (score is target), or is broke (score is 0).
The default values of this applet is for a simple coin toss with a fair coin.

For more information about Gambler's Ruin, see e.g.

Explanations of the values to set etc

Simulate Start a simulated run (a session of plays).
Reset Reset the accumulated parameters, e.g. total wins and losses.
Values This is a "," (comma) separated string, e.g.
-1,1
is the values for simple coin toss, where (say) head gives a loss of 1 and tail gives a gain of 1. The value vector of
-1,-1,1,1,1,1
may be seen as the game where you win 1 if a dice thrown shows 3,4,5,6 and you loose 1 if it shows 1 or 2.
Probabilities The probability vector is a "," (comma) separated string, e.g.
0.5,0.5
which is the even probabilities for (e.g.) a coin toss. If the numbers don't add up to exactly 1 (as valid probabilities must), the program scales (normalizes) the values to proper probabilities. E.g.
1,1
is the same as the probabilities
0.5,0.5
A probability vector
1,2
assigns the first value twice chances of the second value over the first, i.e. is the same as the probability vector
0.33,0.66
Start stake This is the stake the player start with.
Target The target amount the player tries to win.
Statistics The statistics is:
  • Score: The final score (either 0 or target value)
  • Min value: The minimum value in this run
  • Max value: The maximum value in this run
  • Runs length: The number of plays in this run
  • Wins: Number of wins
  • Losses: Number of losses
  • Prob. of ruin: The calculated probability of ruin given the probability of winning, start stake and target.
Please note that for even quite small values of start stake and target - say 500 as start stake and 1000 as target - can give quite a long run, often over 100000, which will take some time (and memory).
Back to my other simulations
Back to my homepage
Created by Hakan Kjellerstrand hakank@bonetmail.com