0
$\begingroup$

I am trying to program a machine that has 3 independent "reels", that are "rolled", and stops on 3 random icons The base machine is a basic slot with e.g. 100 possible combinations. I could now calculate a probability table to find that the base machine has a Return to Player (RTP)

However, the machine can also enter a bonus state. e.g. 6/100 times it enters a bonus game for 15 rolls.

Pseudo code for the algorithm looks a bit like this:

For 15 spins:

-- every time three bonus icons are rolled

----- Payments are raised: 2x then 5x then 15x

I can program this, but I want to know how to calculate the payout, such that I don't have to find a suitable and balanced payout by trial and error.

My first intuition would be:

p(2x) = calculate the probability of getting into a bonus game and then getting to the 2x bonus = 3/100

p(5x) = calculate the probability of getting into a bonus game and then getting to the 5x bonus = 2/100

p(15x) = calculate the probability of getting into a bonus game and then getting the 15x bonus = 1/100

and then, based on this answer , summing the probabilities like this

$$\frac{((94/100) * payoffBase) + ((3/100) * payoff2x) + ((2/100) * payoff5x) + ((1/100) * payoff15x)}{100}$$

(Note that the numbers are examples.)

I feel like i'm definately missing something, especially since the bonus game only lasts for 15 spins, which I don't believe I'm taking into account.

Hope you can help!

$\endgroup$
5
  • $\begingroup$ I would consider a state machine. At any point in time the state is a tuple with the payout for that state and how long the machine has been in a bonus state (could be $0$). Then write the matrix of transition probabilities between states. With that information you can calculate the probability that the machine is in any particular state and thus the average payout to get the RTP you want. The same machine will be useful at runtime to track the current state. $\endgroup$ Jan 11, 2022 at 21:43
  • $\begingroup$ i) If there are three wheels each with the same set of icons, the number of possible combinations is a power of 3. 100 is not one of those. So it seems that we have no information of the probability of getting the set of three bonus icons and eventually there is no way to calculate the mean return. (ii) Does the "payments are raised" mean that for the remainder of the 15 spins, each roll returns the enhanced payment, or is this only for that particular roll that shows the bonus icons? $\endgroup$ Jan 11, 2022 at 23:37
  • $\begingroup$ @R.J.Mathar i) I should've picked better examples, my bad. ii) Yes, you're exactly right. $\endgroup$ Jan 12, 2022 at 9:16
  • $\begingroup$ (i) On which of the 2 cases of the "or" am I "exactly right" with? (ii) What happens if in the 15 rolls there are 4 consecutive hits that win? Does the 4th hit win 15 times the payoff or is the multiplier back to 1 or 2? What happens if there are 6 consecutive wins or 1 win, 1 non-win and another win (does the 2nd non-consecutive trigger 2x bonus)? $\endgroup$ Jan 12, 2022 at 14:45
  • $\begingroup$ @R.J.Mathar When you gather 3 bonus icons, all winning combinations on the slot have 2x payoff until you gather 3 more (total of 6) bonus icons (raises you to 5x payoff), or your 15 spins run out (ends the bonus game, back to 1x payout). Same for the next threshhold. Thanks for trying to understand it! $\endgroup$ Jan 12, 2022 at 22:37

1 Answer 1

0
$\begingroup$

$E_1=pr$ is the expectation value of the payoff in regular game. Here $r$ is the base payoff in a single regular game and $p$ the probability of winning in a single regular game. Let $E_b$ be the expectation value of the payoff in a 15-rolls bonus game, and $b$ be the probability of entering a bonus game. Then the expectation value of the payoff is $bE_b+(1-b)E_1$.

[We assume for simplicity that all bonus games will be finished; if otherwise players may leave the machine earlier, the statistics becomes more complicated.]

The expectation value for the payoff in the bonus game depends on how many of the 15 rolls are wins. Let $w$ be the number of wins in single regular games in a bonus game, $0\le w \le 15$. The payoffs of $R(w)$ then are (note I'm trying to nail down the fuzzy description, in particular the 3rd win already pays off with $2r$, the 6th win already with $5r$, i.e., raises of pay-offs are AT multiples of 3 wins, not AFTER... and pay-offs are instant/not revocable.) \begin{multline} R(0)=0r\\ R(1)=1r\\ R(2)=(1+1)r=2r\\ R(3)=(1+1+2)r=4r\\ R(4)=(1+1+2+2)r=6r\\ R(5)=(1+1+2+2+2)r=8r\\ R(6)=(1+1+2+2+2+5)r=13r\\ R(7)=(1+1+2+2+2+5+5)r=18r\\ \end{multline} and so on. The number of ways of distributing the $w$ wins over 15 is $\binom{15}{w}$. The probility of any particular sequence of $w$ wins is $p^w(1-p)^{15-w}$, so the probability of $w$ wins in the bonus game without regard of order is $\binom{15}{w}p^w(1-p)^{15-w}$. The payoff with $w$ wins is $\binom{15}{w}p^w(1-p)^{15-w}R(w)$. The expectation value of the payoff in a bonus game is $E_b=\sum_{w=0}^{15} \binom{15}{w}p^w(1-p)^{15-w}R(w)$, which concludes the maths of the expected pay-off.

Maple implementation:

# payoff for w wins inside a bonus game of 15 rolls
R := proc(w,r)
        local  p,i ;
        if w > 15 then
                error "w larger than 15"
        end if;
        p := 0 ;
        for i from 1 to w do
                if i < 3 then
                        p := p+ r ;
                elif i < 6 then
                        p := p+ 2*r ;
                elif i < 9 then
                        p := p+ 5*r ;
                else
                        p := p+ 15*r ;
                end if;
        end do:
        p ;
end proc:
r := 'r' ;
p := 0.4 ;
b := 0.05 ;
E1 := r*p ;
Eb := add( binomial(15,w)*p^w*(1-p)^(15-w)*R(w,r),w=0..15) ;
b*Eb+(1-b)*E1 ;

This gives a payoff of $1.1516r$ if $p=0.4$ and $b=0.05$, for example.

$\endgroup$
1
  • $\begingroup$ That did the trick I believe. I tried the calculations with p = 0.4 and b = 0.05, and r=3000, and found the machine to have a pay-off of about 160%. This seems pretty realistic to me, but I will try to run some tests on the implementation. Thanks a lot for taking your time! $\endgroup$ Jan 15, 2022 at 16:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .