Markov Chain Simulation: Gambler's Ruin
Background
This simulation describes a gambling game where a gambler starts with an initial amount of money and can win or lose one unit of that money in each round of gambling.
The source of this idea is Markov Chains and Their Applications, a math thesis presented by Fariha Mahfuz in 2021 at the University of Texas at Tyler.
Instructions
Using the slider inputs below, select the starting balance, upper limit of winnable currency, number of rounds of gambling, and the probability of winning in each round of gambling.
Constraints
The rules are as follows: the gambler must have at least one dollar and up to one dollar less than the maximum winning amount to continue playing, the game stops when the gambler has
zero dollars or when the gambler receives the upper limit of currency, one dollar is bet in each round, a winning gamble results in one additional dollar and a losing gamble results in one lost dollar.
Note: the initial amount of money must be less than the total winning amount because the game will have been won if the values are equal. The slider inputs adjust automatically when the values require adjustment.
Transition Matrix
This matrix describes the nodes and step probabilities in the Markov chain. It is a column stochastic transition matrix where each column sums to a value of one.
Gambler's Vector
This table describes the gambler's starting money. A "1" is present in the vector, shown as a column here,
at the position correlated with the value of the gambler's starting money. The position of the "1"
changes with the "Starting Balance" slider input. The vector length changes with the "Upper Limit" slider input.
Earnings Probability Vector
The vector resulting from the product of the Transformation matrix and the Gambler's Vector.
Interpretation: The vector contains the probabilities of having each associated amount of money left over.
A high probability of having 0 dollars suggests a losing strategy. A high probability of having the maximum number dollars suggests a winning strategy.
Try adjusting the starting value while leaving the other slider inputs stable to learn the effect of starting value on final earnings probabilities.