Stay informed with the
NEW Casino City Times newsletter!
Recent Articles
Best of Alan Krigman

How to design a slot machine

22 November 2010

Many gambling buffs consider slot machines among the great mysteries of the universe, shrouded in myth and guided by the unseen hand of fate. True, the math underlying the chances and returns on slots call for statistical expertise. And programming the computer chips takes some software skill. But the underlying concepts are simple. Let's design a rudimentary multi-line game. The process will help you understand what's happening in the more elaborate little monsters lining the aisles of your favorite friendly neighborhood den of iniquity.

Say you have a brainstorm about the world waiting for a slot version of tic-tac-toe. The screen will show the familiar three-row, three-column array. Players can bet on up to eight lines – three down (rows), three across (columns), and two diagonals. You allow them to pick from one to eight lines and select, for each, whether they're wagering on x's, o's or stars. When "play" is pressed, one or another of the symbols appears in each of the nine cells in the array. Players win on lines that cross through three of whichever symbol they chose.

Internally, triggering a round causes the computer chip to pick an x, an o, or a star at random. Programs called "random number generators" perform this function. These programs are the electronic equivalents of hats containing slips of paper marked with the various symbols. Figuratively, the computer reaches in and takes a slip without peeking. Whatever's on the slip is displayed in the first cell of the array. The computer replaces the slip, mixes the contents of the hat, draws again to get the symbol for the next cell, and continues until the array is filled.

A human could see at a glance which lines won, and increment the payout register accordingly. Computers aren't this good... yet. One way a computer could do the job, though, would be for it to "shadow" the symbols internally with numbers, for instance x = 1, o = 10, and star = 100. Then it can add the values along each line such that sums of exactly 3, 30, and 300 correspond to wins on x's, o's, and stars, respectively. Any other totals, such as 36, 133, or 203, lose.

The final major design challenge is how much to pay winners. This involves the probability of a line winning and the resulting house edge or player return percentage.

Since, in this game, players can select x's, o's, or stars arbitrarily for each line, it makes sense to pay the same amount for a win regardless of the selected symbol. In this case, the probabilities associated with each of the individual symbols would be one out of three or 1/3. Were the hat used as the random number generator, there would be the same number of slips for each symbol. The chance of three on a line being the same would then be (1/3) x (1/3) x (1/3), or 1/27.

Pretend you set up the game so betting one unit wins 25; it "returns" 26 because the machine awards players their wins and also gives them back their original bets. The calculation for house edge would be (1/27) x 25 - (26/27) x 1, or -(1/27), which equals 3.7 percent. The equivalent player return is (1/27) x 26, or 96.3 percent. You can visualize these figures intuitively in terms of 27 statistically-correct trials at \$1 each. Players would win once, picking up \$25; they'd lose 26 times, leaving \$26 behind. Net loss on a total of \$27 at risk would be \$1. The house would earn \$1 per \$27 bet, the 1/27 (3.7 percent) edge found by calculation. Players would have started with \$27 and finished with \$26, the \$25 win plus the \$1 bet, and \$26/\$27 is 96.3 percent return.
Lots of variations are possible. You could return only \$25 for a winning line – a \$24 win plus the \$1 bet back. The probabilities don't change, so edge would be (1/27) x 24 - (26/27) x 1 or -(2/27) which equals 7.4 percent; player return is (1/27) x 25, which equals 25/27 or 92.6 percent. Maybe you don't want players to specify x's, o's, or stars, but receive payouts based on which symbols line up. This suggests that each should have a different probability. Perhaps the hat contains two x's, three o's, and five stars. The probabilities at each cell would therefore be 2/10 for x, 3/10 for o, and 5/10 for star. For each winning line, they'd be (2/10) x (2/10) x (2/10) or 8/1000 for x's, (3/10) x (3/10) x (3/10) or 27/1000 for o's, and (5/10) x (5/10) x (5/10) or 125/1000 for stars; the residual 840/1000 probability would be a loss. A corresponding set of returns for \$1 bet might be \$35 for x's (win \$34), \$15 for o's (win \$14), and \$2 (win \$1) for stars. With these figures, edge becomes (8/1000) x 34 + (27/1000) x 14 + (125/1000) x 1 - (840/1000) x 1 or -(65/1000) which equals 6.5 percent; player return is (8/1000) x 35 + (27/1000) x 15 + (125/1000) x 2, which equals 935/1000 or 93.5 percent.

The key elements in this simplified example as well as on real machines are the same. They comprise ways to: a) randomly select the outcome for each element in the game, b) recognize the value associated with the combined set of results, and c) assign payouts to achieve a house edge/player return that keeps the bosses in clover and the solid citizens on the edges of their seats. The rest is high-falutin' computer programming and artists' razzle dazzle but has nothing to do with gambling. The poet, Sumner A Ingmark, parted the veil when he versified:

Explanations fundamental,
Oft belie the transcendental.