I am working on calculating the odds that any particular combination of icons will appear in a 5-reel slot machine. I have the formulas for most types of combinations figured out. However, I'm stumped on how to handle Wilds, which are a rather special case.
Wilds count as wildcards, meaning they can be used to complete other combinations. For this particular machine, Wilds have their own pay multiplier in addition to counting as other types of icons. Combinations for other icons have to start on the left, but Wilds count in any position of those combinations. Any given icon may occur more than once on a particular reel; for example, there might be five Ks and two As on the first reel.
For example, consider the following combinations (where W = Wild):
- 5 A W A W : This counts as one 5 and no other icons
- A 5 W A W : This counts as one A and no other icons
- 5 W A W A : This counts as two 5s AND one Wild
- W A A W 5 : This counts as four Aces AND two Wilds
I'm having trouble figuring out a formula that can calculate the odds of different numbers of Wilds appearing in valid combinations. For example (pretending that icons aren't weighted to simplify things), the odds that a Wild appears in the only the first and fourth positions of a valid combination are:
$ \frac{(\#\;of\;W\;in\;reel\;1)\;x\;(num\;of\;icons\;besides\;W\;in\;reel\;2)\;x\;(\#\;of\;icons\;in\;reel\;3\;that\;match\;the\;icon\;in\;reel\;2)\;x\;(\#\;of\;W\;in\;reel\;4)\;x\;(\#\;of\;icons\;in\;reel\;5)} {(Total\;number\;of\;possible\;combinations\;on\;the\;machine)}$
which we could rewrite as
$P(1\;is\;a\;W)\;x\;P(2\;is\;not\;a\;W)\;x\;P(3\;is\;the\;same\;as\;2)\;x\;P(4\;is\;a\;W)\;x\;P(1)$
The first two calculations seem simple enough, but then the third calculation (# of icons in reel 3 that match the icon in reel 2) will depend on which icon is selected for reel 2.
Is there a single formula that will encompass all of the different icons that could occur on reels 2 and 3, or would I have to do something like this?
$P(\;\#1\;is\;a\;W)\;x\;P(\;\#2\;is\;a\;5)\;x\;P(\;\#3\;is\;a\;5)\;x\;P(\;\#4\;is\;a\;W)\;x\;1$
+
$P(\;\#1\;is\;a\;W)\;x\;P(\;\#2\;is\;a\;6)\;x\;P(\;\#3\;is\;a\;6)\;x\;P(\;\#4\;is\;a\;W)\;x\;1$
+
$P(\;\#1\;is\;a\;W)\;x\;P(\;\#2\;is\;a\;7)\;x\;P(\;\#3\;is\;a\;7)\;x\;P(\;\#4\;is\;a\;W)\;x\;1$
+(...)
If the icons on wheels $2$ and $3$ are all different from each other the same between the wheels, the chance $3$ matches $2$ is just $1/$number of icons on a wheel because whatever $2$ shows there is just one way for $3$ to match it. If the wheels are different or there are multiples of some icon you have more work to do and we need to know the exact distribution of icons on each wheel.
Added: if the wheels have multiples of some of the icons, you need to go through the cases. Say wheel $2$ has $3\ A$s, $2\ B$s and ten other distinct icons, $C$ through $L$, then wheel $3$ has $1\ A, 3\ B$s, $2\ C$s and one each of $D$ through $L$. The chance they match is then $\frac {3\cdot 1 + 2 \cdot 3 + 1\cdot 2 +9\cdot 1 \cdot 1}{15^2}$