0
\$\begingroup\$

I'm designing a slot machine.

I need to find the number of combinations that two matching icons will appear side-by-side in a 3X5 window (3 rows, 5 reels (columns))

A match gives the user some payout.

Having the following assumptions: Icons: H1, H2, X (all the rest). Matching Icons: should meet on the same row (side by side) (wild doesn't count here)

Window is as follows:

|   |   |   |   |   |
---------------------
|   |   |   |   |   |
---------------------
|   |   |   |   |   |

I have listed all possible options, and now I would like to get the exact number of combinations per each option.

Example of what I need:

The number of possibilities for this kind of scenario (1 of 72 possible ones):

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | X | X |

Number of H1 icons on reels 1-5: R1_H1, R2_H1, R3_H1, R4_H1, R5_H1

Number of H2 icons on reels 1-5: R1_H2, R2_H2, R3_H2, R4_H2, R5_H2

Number of all icons on reels 1-5: RL1, RL2, RL3, RL4, RL5 (respectively)

Some more examples:

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | H1| H2|


| H1| H2| H2| H1| X |
---------------------
| X | X | X | X | X |
---------------------
| X | X | X | X | X |

And so on.. the only limitation I put is that H1 and H2 icons on the same reel have distance between them so I won't have kind of the following scenario:

| H1| H2| X | X | X |
---------------------
| X | X | X | X | X |
---------------------
| X | H1| H2| X | X |
\$\endgroup\$
  • \$\begingroup\$ I aren't quite understanding your description of the multiple scenarios, could you clarify a bit? Perhaps a second example would help. \$\endgroup\$ – Dave Aug 6 '14 at 11:21
0
\$\begingroup\$

First you need the probability they'll be on the same line at all.

Then, go through each possible position on a line for H1, counting the number of possible H2 positions that pay out, and those that don't. The probability is payouts/(payouts + non-payouts).

Multiply the two probabilities and you'll have your answers.

There are more mathematically elegant ways to do this, or you could write a small program to brute force it, but for small numbers like this it's not really necessary.

\$\endgroup\$
  • \$\begingroup\$ Thanks for your reply. Yet, I do look for the very elegant mathematical way to calculate this; cause the scenario I have posted above is just one of 72 all possible scenarios, and I prefer to have robust way to calculate this. \$\endgroup\$ – YevgenyM Aug 6 '14 at 10:56
  • 1
    \$\begingroup\$ Write a program to brute-force it, then. Much else and you're over-engineering. \$\endgroup\$ – Dave Aug 6 '14 at 11:04
  • \$\begingroup\$ Kind of considering the Brute-Force method now; possibly make it tree structure and then just scan it and count all possibilities for each scenario. \$\endgroup\$ – YevgenyM Aug 6 '14 at 11:33
  • \$\begingroup\$ Sounds like a good plan. \$\endgroup\$ – Dave Aug 6 '14 at 11:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.