# Calculating the Payout of an Unusual Digital Slot Machine

Say you have a digital slot machine. Rather than using virtual reels, this slot machine generates results using predetermined probabilities for a given symbol appearing in any position.

Given:

• Five 'reels' (positions for a symbol to appear)
• Wild symbols exist (and have their own probability of appearing)
• Matches must be left-aligned

How does one calculate the probability of each possible number of matches, 0-5, for a given symbol?

(A 'match' of 1 would mean a symbol appears in the left-most position, but is not followed by itself or a Wild.)

What follows is a description of my attempts to solve this problem.

As an example: the Cherries symbol pays 4x the bet for 3 matches. In any given position, Cherries has a 20% chance of appearing, and Wild has a 2% chance of appearing.

My first attempt at calculating this probability was $0.2 * (0.2 + 0.02)^2 = 0.00968$. At least one Cherries, plus two more symbols which are either Cherries or Wild. $4 * 0.00968 = 3.872%$ pay for 3 Cherries.

It then occurred to me that this probability would seem to also include the probability of getting a match of 4 Cherries and would need to exclude the chance of the next symbol being Cherries or Wild. Thus, I updated the calculation to be $0.2 * (0.2 + 0.02)^2 - (0.2 * (0.2 + 0.02)^3) = .0075504$, giving a payout of ~3.020%. (This step is skipped if we are testing for 5 matches, since 6 matches is impossible.) Is this correct?

• What do you mean by "matches must be left-aligned"? Also, this may just be my ignorance of slot machines, but what is a match and how does the system work? – shardulc says Reinstate Monica Apr 5 '16 at 16:55
• Matches must be left-aligned: This means the first symbol must either be the match symbol or a wild symbol. For instance, if in our five reels we had Cherries; Grapes; Cherries; Cherries; Cherries, this would only be a match of 1 because Grapes is not a match. If our five reels were Wild; Cherries; Grapes; Cherries; Cherries, this would be a match of 2. – Benji Kay Apr 5 '16 at 17:08
• A match is a group of matching symbols, and Wilds are also included as part of a match. Generally speaking, the higher number of matches you have, the more the slot machine will pay (but some symbols are worth more than others, so 2 Bar symbols may be worth more than 3 Cherries, for instance). – Benji Kay Apr 5 '16 at 17:10

There are two different quantities we can calculate: the probability of a match with some number of symbols, and the expected payout of a match with some number of symbols.

Let us do probability first. Say you have the Cherries symbol, which appears with a probability $p_c$, and the Wild symbol, which appears with a probability $p_w$. In your case, this would be $p_c = 0.2$ and $p_w = 0.02$. If we want to get exactly $n \geq 3$ matching symbols then the probability is $$n \cdot p_c \cdot (p_c + p_w)^2 \cdot (p_c + p_w)^{n-3} \cdot (1 - (p_c + p_w))$$ (For $n = 5$, as you said, the last term does not need to be taken into account because there is no sixth symbol.) If we want exactly $2$ matching symbols, then the probability is $$2 \cdot p_c \cdot (p_c + p_w) \cdot (1 - (p_c + p_w))$$ Exactly $1$ matching symbol: $$p_c \cdot (1 - (p_c + p_w))$$ $0$: $$1 - (p_c + p_w)$$

This is similar to what you did, except that you subtracted the probability of getting a matching symbol; you should instead multiply by the probability of not getting a matching symbol, which is $1 = 100\%$ minus whatever the probability is.

When doing probabilities, you should always remember that 'and' is translated as 'multiply', while 'or' is translated as 'add'. You want a Cherry before and no Cherries afterwards, so you multiply. Subtraction of probabilities does not have any meaning here.

The expected payoff is slightly trickier. We assume that 3 Cherries give a payoff of 4x, 4 Cherries give a payoff of 15x, and 5 Cherries, 50x. 0, 1, or 2 Cherries are worthless, in that you actually lose the money you bet. If you bet 1 monetary unit, then your expected payoff from Cherries is \begin{align} e =\ &(1 - (p_c + p_w)) \cdot (-1) + p_c \cdot (1 - (p_c + p_w)) \cdot (-1) + \\ &2 \cdot p_c \cdot (p_c + p_w) \cdot (1 - (p_c + p_w)) \cdot (-1) + 3 \cdot p_c \cdot (p_c + p_w)^2 \cdot (1 - (p_c + p_w)) \cdot 4 + \\ &4 \cdot p_c \cdot (p_c + p_w)^3 \cdot (1 - (p_c + p_w)) \cdot 15 + 5 \cdot p_c \cdot (p_c + p_w)^4 \cdot 50 \end{align} Here, we are adding the products of probabilities and the corresponding payoffs, where for the first two terms, the payoff is $-1$ because you lose money. Note that this is the expected payoff from Cherries only; we are not including the possibility that you get 0 Cherries but instead get 4 Apples, which gives you a lot of money. To do that, we have to calculate the payoffs from each type of symbol separately and add them together.

Using the example probabilities you have given, we can write \begin{align} e =\ &(1 - 0.22) \cdot (-1) + 0.2 \cdot (1 - 0.22) \cdot (-1) + \\ &2 \cdot 0.2 \cdot 0.22 \cdot (1 - 0.22) \cdot (-1) + 3 \cdot 0.2 \cdot 0.22^2 \cdot (1 - 0.22) \cdot 4 + \\ &4 \cdot 0.2 \cdot 0.22^3 \cdot (1 - 0.22) \cdot 15 + 5 \cdot 0.2 \cdot 0.22^4 \cdot 50 \\ \approx\ &-0.697 \end{align}

So an average, you will lose $0.697$ monetary units, which is an average payout of $30.3\%$ when you play this game for Cherries (we are not counting other symbols). The expected payoffs for other symbols are also likely to be negative; in short, don't gamble! :)

Edit: From your comments, I gather that the probabilities of $0.2$ and $0.02$ are just one part of the total probabilities of these symbols appearing. You can plug the actual figures into the formula above and get the correct average payout.

• Thank you for this thorough response! I'm finding, however, that your formula for calculating match probabilities and mine give the exact same result (note that I am not subtracting the probability of getting some other symbol, but the probability of getting 4 matches). Actually, I was using your calculation at one point in trying to solve this problem, but it confused me in that it didn't seem to take into account the fact that the non-Cherries, non-Wild symbol must come last. By multiplying each of the probabilities together, aren't we saying that the order does not matter? – Benji Kay Apr 6 '16 at 14:38
• I am looking for a flaw in the logic because I find when I simulate spins, the actual result does not match what is predicted by these formulas. For instance, your formula and mine predict the odds of 1-5 matches for Cherries as 14.55%; 3.00%; 0.62%; 0.13%; 0.03%, respectively. In practice, I see matches as ~14.25%; ~3.23%; ~0.68%; ~0.14%; ~0.038% across one million simulated spins. – Benji Kay Apr 6 '16 at 14:43
• Also, in the world of slots, I've found that pays are generally given as what they pay back as a percentage of the amount paid to play rather than what they cost. In your example, would the Cherries pay percentage be found as 1 - 0.917 = 8.3%? – Benji Kay Apr 6 '16 at 14:59
• (Also note, the predicted odds and simulated results above take into account a more complicated reality of symbol odds. Symbols don't have just one probability of appearing, but multiple probabilities of appearing, each with its own probability of being the selected probability. Given the fixed probability provided in my example, the predicted probabilities of getting 1-5 matches would be 15.60%; 3.43%; 0.76%; 0.17%; and 0.05%, respectively.) – Benji Kay Apr 6 '16 at 15:06
• Re. comment 1: if the order did not matter, then we would have to include a multiplier like $n!$ to account for all orders that the symbols can appear in. Here, though we're not specifying the order explicitly, there is only one possible order we are calculating, which is the left-to-right order. Re. comment 2: probabilities won't match exactly, because 1. they're probabilities and 2. you're probably using a pseudorandom number generator somewhere, which is biased. Re. comment 3: Yes. Re. comment 4: could you elaborate on this? This might affect the probabilities in your simulation. – shardulc says Reinstate Monica Apr 6 '16 at 15:38