Introduction
Understanding and applying Markov chains is an essential component of calculating probabilities in casino games that would otherwise become unwieldy. I have used Markov chains in calculating probabilities associated with popular slot features such as collection bonuses, sticky Wilds, and Lightning Link-style bonuses.
I typically use Markov chains in a games where there are a reasonable number of states the player can go through. The definition of reasonable depends on time constraints and computational processing power available. Because matrix multiplication is involved, the processing time grows cubically with respect to the number of states.
The Basics
To model a game as a Markov process we must define the following items:
- A well-defined state space
. This is simply the set of all the states the player can be in.
- A probability distribution of the initial state space,
. i.e. What is the initial probability of being in each state?
is typically represented by a
row vector.
- The transition matrix,
. Each element of
defines the probability of moving from one state to another. For example, the probability of transitioning from state
to state
would be given by the
row and
column of
. Note that it is essential that
does not change from round to round.
From here we can easily determine the state probability distribution at each step in the process:
is a
dimensional vector that represents the probability of being in each state after the
step of the process.
Example
Consider a game where a player is given an equal chance of starting with 1, 2 or 3 fair coins. At the beginning of each round all coins are flipped and every coin that flipped heads is removed. The game is played until all coins have been removed. As a prize for making it to each successive round the player is paid $1 at the beginning of the first round, $2 at the beginning of the second round, $3 at the beginning of the third, etc.
To model this game as a Markov process we first define all the states that player can be in at each round. The states are 1). no coins removed, 2). 1 coin removed, 3). 2 coins removed, and 4). all coins removed (or game over).
Since the game has an equal chance of starting with 1, 2, or 3 coins already removed, we define the initial state vector like so:
It usually takes a little more work to determine the transition matrix. For this game it is defined as follows:
From here we can determine the state distribution vector at each round of the game…
where
Side note: In case you’re wondering on how to get a nice formula for , you can take a look at this example. In my case, I cheated and used Mathematica. 🙂
These value represents the probability of being in state
during round
. Note that based on the above equations it is clear that
, implying that the game is guaranteed to end given enough time. A few more interesting properties of this game can be uncovered by analyzing these equations. For example, on average, how many rounds of this game can the player be expected to play?
How about the value of the game itself?
What other interesting properties from this game can you discover by modeling the game as a Markov chain?