Let’s look at a slot’s programming

Viewing 15 posts - 1 through 15 (of 94 total)
  • Author
    Posts
  • #48104
    argyl53 WANTED $207
    Outlaw

    ….and put this random and RTP stuff to bed.

    I’ve programmed a very simple slot game, where you can follow and run the code yourself.

    The slot is a 3 reel, one win line classic “one arm bandit” style. There are 3 symbols: X, BAR and 7. To win a prize, you must match 3 of the same symbol on the win line.

    The outcome of every spin will be 100% genuinely random. By genuinely random, I mean the results will be within a low standard deviation of what would be statistically expected from a genuinely random result set. In plain English, I mean if I toss a coin a million times, I will get an almost exact 50/50 split between the number of heads and tails.

    The game will also have a built-in house edge to yield a long term profit. It will have an RTP of around 95%, the same as many slots you play online.

    In doing this, I hope to demonstrate to you how slots can be both genuinely, 100% random while also being profitable in the long run for their manufacturers in the design. The outcome of each spin on this game is governed and determined only by the random number generator, yet the design of the game’s reels layout and paytable ensures the long term profit. In this sense and for Mr B specifically, I’d like to point out the RTP does not “govern” the random results, rather the random results are independent of the RTP and the RTP is governed by reel and paytable design.

    Note the program I am about to show you, while deliberately very simple, is not theoretical. It’s how the real slots you play online actually work. This game and its code is effectively compliant with Gambling Commission rules.

    The code below is written in a language called PHP, which is commonly used for web development (this site runs on it, for example). I’ve chosen this because it’s very easy to follow and understand. I have added comments to explain what each line is doing. Apologies, I don’t know in advance of posting how this will format on the forum.

    How to run the game:

    Head on over to http://sandbox.onlinephpfunctions.com/ and paste in the code linked below. Click “Execute code” and see the output.

    Things to do:

    Change $spins from 100000 to 10, then to 100, then to 1000….look at how the RTP wildly differs on a smaller number of spins. Notice that the more spins you give it, the closer the results consistently trend towards our 95% RTP.

    Change the paytable – halving the prizes halves the RTP.

    Change the reels layout – see how it affects the results.

    See the code:

    https://pastebin.com/P3Ynanrc

    1
    #48105
    Mr B WANTED $381
    Outlaw

    I’ve RIGGED a very simple slot game

    1
    #48108
    argyl53 WANTED $207
    Outlaw

    @Mr B, I don’t know what you think rigged means, but that word doesn’t mean whatever you think it means. An event is rigged if its outcome can be manipulated or controlled. Clearly in this case there is no rigging, since we are solely at the mercy of a random number generator which cannot be predicted or controlled.

    To any sensible, genuinely interested people – if you have any questions or discussion points, I’m happy to answer.

    #48111
    Seedy WANTED $379
    Sheriff

    *Sigh* can we now stop with the RTP argument everyone please I don’t wanna have to pull my big hose out on you fine fellows lol 🙂

    so what I will actually do is put this whole RTP shit to bed right now……

    You are all entitled to believe what you want to believe in respect to rigged or not rigged RTP….

    Can you just please get along again lol 🙂 I’m ill and can’t look at my phone or PC to long as my brains hurting 🙂 so just respect each others difference of opinion and move on 🙂

    #48113
    Mr B WANTED $381
    Outlaw

    argyl53 wrote:

    @Mr B, I don’t know what you think rigged means, but that word doesn’t mean whatever you think it means. An event is rigged if its outcome can be manipulated or controlled. Clearly in this case there is no rigging, since we are solely at the mercy of a random number generator which cannot be predicted or controlled. To any sensible, genuinely interested people – if you have any questions or discussion points, I’m happy to answer.

    Quit the insults argyl. This will go down hill very quickly if you do that again.

    I stick by the edited quote.

    #48127
    argyl53 WANTED $207
    Outlaw

    Seedy wrote:

    *Sigh* can we now stop with the RTP argument everyone please I don’t wanna have to pull my big hose out on you fine fellows lol 🙂

    so what I will actually do is put this whole RTP shit to bed right now……

    You are all entitled to believe what you want to believe in respect to rigged or not rigged RTP….

    Can you just please get along again lol 🙂 I’m ill and can’t look at my phone or PC to long as my brains hurting 🙂 so just respect each others difference of opinion and move on 🙂

    In respect of the subject matter, I think it’s a relevant, healthy conversation to have here. But yeah I don’t want any nastiness around it, so I will certainly promise to keep it friendly and not be baited.

    #48130
    argyl53 WANTED $207
    Outlaw

    Here are some sample results from a series of runs for anyone who can’t run the code. Notice how the more spins are in a run, the less and less divergence we have from that 95% theoretical RTP. When we only do 10-500 spins, the RTP can be as low as 0% and as high as 134%. By the time we’re doing 100,000 spins, we’re barely deviating from the theoretical RTP at all. By one million spins, you have an almost spot-on match between the theoretical and actual RTP.

    Spins: 10
    Total bet: 10
    Total wins: 0
    Number of X-X-X: 0
    Number of B-B-B: 0
    Number of 7-7-7: 0
    RTP: 0

    Spins: 10
    Total bet: 10
    Total wins: 10
    Number of X-X-X: 0
    Number of B-B-B: 1
    Number of 7-7-7: 0
    RTP: 100

    Spins: 10
    Total bet: 10
    Total wins: 4
    Number of X-X-X: 2
    Number of B-B-B: 0
    Number of 7-7-7: 0
    RTP: 40

    Spins: 50
    Total bet: 50
    Total wins: 24
    Number of X-X-X: 2
    Number of B-B-B: 2
    Number of 7-7-7: 0
    RTP: 48

    Spins: 50
    Total bet: 50
    Total wins: 42
    Number of X-X-X: 6
    Number of B-B-B: 3
    Number of 7-7-7: 0
    RTP: 84

    Spins: 50
    Total bet: 50
    Total wins: 36
    Number of X-X-X: 3
    Number of B-B-B: 3
    Number of 7-7-7: 0
    RTP: 72

    Spins: 250
    Total bet: 250
    Total wins: 226
    Number of X-X-X: 38
    Number of B-B-B: 15
    Number of 7-7-7: 0
    RTP: 90.4

    Spins: 250
    Total bet: 250
    Total wins: 196
    Number of X-X-X: 38
    Number of B-B-B: 12
    Number of 7-7-7: 0
    RTP: 78.4

    Spins: 250
    Total bet: 250
    Total wins: 336
    Number of X-X-X: 28
    Number of B-B-B: 18
    Number of 7-7-7: 1
    RTP: 134.4

    Spins: 500
    Total bet: 500
    Total wins: 384
    Number of X-X-X: 62
    Number of B-B-B: 26
    Number of 7-7-7: 0
    RTP: 76.8

    Spins: 500
    Total bet: 500
    Total wins: 302
    Number of X-X-X: 56
    Number of B-B-B: 19
    Number of 7-7-7: 0
    RTP: 60.4

    Spins: 1000
    Total bet: 1000
    Total wins: 788
    Number of X-X-X: 129
    Number of B-B-B: 53
    Number of 7-7-7: 0
    RTP: 78.8

    Spins: 1000
    Total bet: 1000
    Total wins: 816
    Number of X-X-X: 143
    Number of B-B-B: 53
    Number of 7-7-7: 0
    RTP: 81.6

    Spins: 10000
    Total bet: 10000
    Total wins: 10282
    Number of X-X-X: 1291
    Number of B-B-B: 570
    Number of 7-7-7: 20
    RTP: 102.82

    Spins: 100000
    Total bet: 100000
    Total wins: 94938
    Number of X-X-X: 12179
    Number of B-B-B: 5468
    Number of 7-7-7: 159
    RTP: 94.938

    Spins: 500000
    Total bet: 500000
    Total wins: 473616
    Number of X-X-X: 62373
    Number of B-B-B: 27537
    Number of 7-7-7: 735
    RTP: 94.7232

    Spins: 1000000
    Total bet: 1000000
    Total wins: 948696
    Number of X-X-X: 123663
    Number of B-B-B: 55177
    Number of 7-7-7: 1496
    RTP: 94.8696

    1
    #48133
    Mr B WANTED $381
    Outlaw

    My post from the ‘other’ thread:

    I’m done with this bullshit. I know I am right and will not support the bullshit. Since insults have been thrown and admin have intervened, I have nothing further to say on the subject.

    Controlled random. Not quite random but worth taking the piss out of people over. It seems.

    #48134
    Eightblack WANTED $236
    Outlaw

    Why is everyone getting so bent out of shape over this topic?? I think you make a valid point argyle and that’s how I’ve always understood it to work and it is interesting as a gambler to see, I just don’t understand the upset over it.

    If you believe the games you willingly put money into are rigged don’t put money into them! And if some random Internet person disagrees with your opinion fuck em don’t start keyboard battles over it.

    1
    #48139
    argyl53 WANTED $207
    Outlaw

    Part II: Calculating the theoretical RTP.

    Look at the reel layouts in the code. Each reel has 20 positions. On Reel 1, 10 of them are Xs. On Reel 2, 11 are Xs and on Reel 3, 9 are Xs.

    So our probability of hitting X-X-X for a 2x win are about 1 in 8:

    P(X-X-X) = P(XonReel1) * P(XonReel2) * P(XonReel3) = (10/20) * (11/20) * (9/20) = 0.12357 = (almost exactly 1 in 8)

    This means across 1 million spins, we would expect 123,570 of them to yield X-X-X on the win line. Notice in the results above, we were very close on the million spins – 123,663 of them gave X-X-X.

    Let’s do the same calculation for BARs and 7s:

    BARs: (7/20) * (7/20) * (9/20) = 0.055 = just over 1 in 20 chance of hitting 3 BARs on the win line. In a million spins, this is 55,000 spins which will hit BAR-BAR-BAR and pay 10x. In the results above, we see in a million spins we hit 55,177. So again, almost spot on.

    7s: 7s pay a huge 100x win, so there aren’t many on the reels, just 3 on the first reel and two each on the others.

    (3/20) * (2/20) * (2/20) = 0.0015 = only 3 in 2000 spins will hit a 7-7-7 line, so in a million spins we expect a mere 1500 jackpot line hits. In the results above, once again we were almost spot on with the RNG, at 1496 jackpot lines.

    How does all of this combine to give us theoretical RTP? Simple. In one million spins, we take it (1 million x Bet Size) so let’s say £1,000,000 and according to the probabilities above we expect to pay out:

    £100 x 1500 = £150,000
    + £10 x 55,000 = £550,000
    + £2 x 123,570 = £247,140

    = £947,140 = 94.714% theoretical RTP.

    This is from just 180,000 of 1 million spins paying out a prize, meaning you have just under 1 in 5 chance of hitting any win in any given spin. So we have a nearly 95% RTP despite the fact roughly 78% of spins will not pay a prize at all.

    I hope this has been informative 🙂 peace out!

    #48244
    groundiskey WANTED $57
    Outlaw

    @argyl53 great read, cheers.

    #48273
    argyl53 WANTED $207
    Outlaw

    @groundiskey cheers mate, really glad at least one person’s got something out of my efforts this afternoon!

    #48318
    Biohazard WANTED $386
    Outlaw

    Great work mate, as always! You already know my thoughts on this.

    #48322
    argyl53 WANTED $207
    Outlaw

    Biohazard wrote:

    Great work mate, as always! You already know my thoughts on this.

    Haha tbh mate I’m more interested in whether any of the conspiracy crowd can point to anything I’ve written here as being factually incorrect and actually say look Argyl, see where you’ve written this, your logic is wrong and this is why. Or if they can point to a line in my program and show me it’s a flaw which makes the results rigged. But I’m reasonably confident that’s not going to happen.

    #48330
    argyl53 WANTED $207
    Outlaw

    Part III: A few other addendums.

    We’ve seen so far how a randomised slot game can be designed to yield a small house edge. At 3 reels, 3 possible symbols and one win line, it’s about as simple a slot as you can get yet behaves very similarly in terms of RTP, frequency and size of payouts as some of the games you might have played for real cash.

    In our example, the machinery of the slot was simple. We took 3 reels and put a total of 20 symbols on each one, made up of X’s, BARs and 7s Most of each reel was made of X’s, then fewer BARS and just a couple of 7s. For the spin, the result was determined by each reel being stopped on the position determined solely by the pick of a random number between 1 and 20. If the 3 positions chosen were all mapped to the same symbol, the corresponding prize was paid.

    The slots you play for real are usually a little more complex. We have multiple winlines, all way pays and bonus features.

    Multiple win lines: the programming isn’t too different to our example for a 10 or 20 line slot. We still pick one position at random for each reel, only this time we take the previous and next symbols too (wrapping around if we hit the end of our listed symbol arrangement for that reel) to form a grid of symbols, then we check each of the winlines in turn for 3, 4 or 5 matching symbols. We define the winlines by their positions on each reel on the grid:

    Line 2:

    2-2-x-x-x
    x-x-2-x-x
    x-x-x-2-x
    x-x-x-x-2

    So this is very much just a scaled up version of what we did for 1 line. We just have more to check after we stop the reels.

    All way pays: The programming for this is the same as above, except instead of checking a grid of winlines, it’s even easier; we just multiply together the number of occurrences of matching symbols on each reel to get the number of winning ways. The only other thing to check for as we go along each reel is that the previous reel had at least one matching symbol.

    Bonus rounds, wild reels, other in-game features and enhancements: here’s where the bulk of programming has to go and where we find the most variation in how games work. Basically, the rules of the Gambling Commission don’t force game manufacturers to make these work to any particular pattern. There are lots of ways they can legitimately work. I might, for example, literally just give you 15 free spins which work exactly the same way as regular spins via the random generator but also all prizes are multiplied by 3. But I could also just randomly pick a win between 10x and 500x and award you that and show it to you in the game in the form of 15 free spins with pre-determined results. I could even make it so when your prize was randomly selected, it was ten times more likely to be 10x than 50x. Provided I told you clearly the bonus could award any amount up to 500x and the game overall had a 96% RTP, that’s entirely allowed within the rules as I understand them. The only key requirement is that the fundamental outcome of the bet was random and the game didn’t mislead you about your chances. Same thing with a gamble feature such as the now famous Reel King ladder. I don’t know how that particular game works, but you could build a game with a gamble ladder such that when the initial win came in, the result was already randomly decided that you would win up to the first 3 gambles, then it donks you if you go any further. That’s allowed, provided the initial outcome was random and the odds of winning actually corresponded to what was shown to you (e.g. winning the first 3 gambles on a ladder is a 1 in 8 chance).

    In respect of Millionaire, a game which comes up a lot here, my understanding of GC rules – and I am happy to be corrected on this one if I’m wrong – is that if it shows you option B has a 60% chance of winning, option B has to actually have had a 60% chance of winning whenever the result was/is decided.

Viewing 15 posts - 1 through 15 (of 94 total)

The topic ‘Let’s look at a slot’s programming’ is closed to new replies.