Author: Dave Smith
Last month viewers: 1
Package: PHP Virtual Slot Machine
An overview of how slot machines work
You step into a casino and usually the first thing you are going to see are the rows and rows of slot machines, known as one arm bandits in the day, although I am not sure they are still called that much today. It is not a bad description though, without fail, over the long run, they are designed to pay out a specific percentage of what they take in. They usually don't take much, they are designed to rob you slowly by paying out around .97 cents for every dollar they take in. That .03 cents per dollar does add up quickly though, they are huge earners for any gambling operation. So... how do they work?
You currently have mechanical slots and digital slots with the only real difference being how the results are displayed to the player. With mechanical slots, there are physical reels that spin and stop in a specific order. With digital slots, the physical reels are replaced with a digital representation. Aside from that, they all operate the same. For our discussion, we will refer to these reels as the physical reel, whether they are on a mechanical or digital machine.
Each physical reel is made up of a set number of stops, a position where the reel stops after spinning, which is usually 22 stops. Each stop contains either a payout symbol or a blank space, and really only do one thing... they display the results with a flair.
The real work is taking place on a chip which contains a random number generator and the virtual reels.
Let's talk about the random number generator first. It is constantly returning play results whether the machine is being played or not, so thousands of games can be played by the time it takes you to drop in that next coin. Once you pull that handle, or press that play button, a play result has been chosen and the game is over. The spinning, the anticipation... it is all part of the show to present the result to the player. There really is no such thing as a hot or cold machine, the last time a machine paid out a large jackpot prize has nothing to do with when it will pay out again. Each play has the same exact odds as any other play.
The bandit magic really takes place on the virtual reels. A virtual reel is like a physical reel except that it has many more stops, usually 64, 128, 256 or more. It is a bit binary, although it really doesn't have to be. The random number generator is determining which stop on this virtual reel is selected. Each stop on this virtual reel is mapped to a stop on the physical reel to display the result. However, the virtual stops are not evenly spread out across the physical stops, they are weighted so that a particular physical stop will be more likely than another. A virtual reel with 128 stops has 128 stops to spread out over the 22 physical stops.
Have you ever noticed that a lot of times you get so close to hitting that jackpot? It was right there, only that last seven needed to one notch down. Must mean that the slot is getting hot and ready to pay out... right? Nope, as stated earlier, the odds are the same for every play. What just happened though is the result of how the virtual reel is weighted. That stop just under the final seven is heavily weighted so that it will show up a lot more that other stops, giving the illusion that you almost hit that jackpot. This is known as the near miss effect and why one arm bandit is a fitting name.
That is it, that is how they all work regardless of the number of reels or pay lines. A physical reel is designed with so many pay symbols and mapped to a much larger virtual reel which sets the weight (or odds) that symbol will appear. All driven by a random number generator pumping out play results until one is selected and displayed.
The virtual slot class lets you design your own slot machine based on these principles. You can manipulate the odds in favor of the machine or in favor of the player, it is all in your hands now.
You need to be a registered user or login to post a comment
1,596,665 PHP developers registered to the PHP Classes site.
Be One of Us!
Login Immediately with your account on:
No comments were submitted yet.