Example: Gambler's ruin

It is the famous Gambler's ruin example. In this example, we will present a gambler. A reluctant gambler is dragged to a casino by his friends. He takes only 50$ to gamble with. Since he does not know much about gambling, he decides to play roulette. At each spin, he places 25$ on red. If red occurs, he wins 25$. If black comes up, he loses his 25$. Therefore, the odds of winning are 50%. He will quit playing when he either has 0 money left or is up to 25$ (75$ total). Let's model this process as a Markov Chain and examine its long-run behavior.

Start the SpiceLogic Markov Chain Calculator and enter four states as shown below.

Markov Chain Calculator wizard with the four Gambler's ruin states entered:  (broke), , , and  representing the gambler's possible bankrolls.

Once you click Proceed, you will be asked to set the probability for state 0$ (broke). As 0$ (broke) is an absorbing state (as you cannot move to another state after you are broke), set this state as an absorbing state.


Markov Chain Calculator wizard marking the  (broke) state as absorbing in the Gambler's ruin example, since the gambler stops playing once out of money.

Then click Proceed and set the transition probability of 25$ state as shown below.

Markov Chain Calculator wizard setting the transition probabilities for the  state in the Gambler's ruin example: 0.5 to  (loss) and 0.5 to  (win).

Then click Proceed and set transition probabilities for the state 50$ as shown below.

Markov Chain Calculator wizard setting the transition probabilities for the  state in the Gambler's ruin example: 0.5 to  (loss) and 0.5 to  (win).

Finally set 75$ state as the absorbing state. Because, once the gambler reaches 75$, he quits the game.

Markov Chain Calculator wizard marking the  state as absorbing in the Gambler's ruin example, since the gambler quits the game once that target is reached.

Then click Proceed and then click the Finish button in the final wizard screen. Then you will get the following result view. You need to set a certain initial state to perform the analysis. Let's assume that the gambler starts with 50$. So, select 50$ from here.

Markov Chain Calculator result view of the Gambler's ruin model with the  state selected as the initial state, ready for probability forecast analysis.

Pop out the charts from the carousel Change the slider to 50 iterations and observe that, after 50 turns, the probability of getting broke is 33%, and getting 75$ and quit is 67%.

Gambler's ruin forecast chart in Markov Chain Calculator at 50 iterations starting from , showing roughly 33% probability of going broke and 67% of reaching .

Now, what if the gambler starts with 25$. We can find out the forecast by selecting the initial state as 25$.

Markov Chain Calculator initial state selector switched to the  state for the Gambler's ruin example to forecast the outcome from a lower starting bankroll.

Once you change the initial state, notice that the probability of getting broke increases to 67%, and the probability of having 75$ decreases tp 33%

Gambler's ruin forecast chart starting from , showing roughly 67% probability of going broke and only 33% of reaching , the inverse of the  starting case.

 



Last updated on Jan 7, 2026