The test game. This series uses one test game. It is not a real product. It has 5 reels and 3 rows. Three scatters start 10 free spins, about 1 time in 151 spins. One feature pays 64 times the stake on average.
The money does not explain the play
The test game has an RTP of 96%. On average, the player loses money in each round. But people play such games for a long time. The money cannot explain this.
Brain science gives an explanation in three parts. The brain signals a surprise, and a win that it expected is no surprise. The brain signals an unknown result before the result comes. And the wish to continue is different from pleasure.
Signal 1: the prediction error
A small group of cells deep in the brain makes dopamine. Dopamine is a chemical that carries a signal to other cells. Scientists recorded these cells in monkeys that got juice as a reward [1].
- The juice came when the animal did not expect it. The cells sent a strong burst.
- A light came before the juice each time, and the animal learned this. Then the burst came at the light. The juice gave no burst.
- The light came, and the juice did not come. The cells went silent at the moment when the juice was due.
The cells do not signal the reward. They signal the reward minus the expectation. This difference is the prediction error. It is positive for a good surprise, negative for a bad surprise, and 0 for a result that the brain expected.
δₜ = rₜ + V(sₜ) − V(sₜ₋₁)rₜ is the money that step t pays. V(s) is the money that the brain expects from the state s to the end of the round. δₜ is the prediction error of step t.Add the money that the step pays to the money that the brain expects after the step. Subtract the money that the brain expected before the step. The result is the prediction error of the step.
rₜ- The money that step t pays, in stakes.
sₜ- The state after step t: the facts that the player sees at that moment.
Example. In the test game, a player with a correct expectation sees 2 scatters after reel 4 and expects 5.98 stakes from the scatters. The third scatter lands: the step pays 0, and the player then expects 64.78 stakes. The prediction error is 0 + 64.78 − 5.98 = +58.80 stakes.
# expected[s]: the money that the player expects from the state s to the end of the round
error = step.paid + expected[step.state_after] - expected[step.state_before]Use it. If the errors are near 0 at each step before the payout, the player can read nothing before the end. Add a cue before the payout (Part 7).
A computer can learn with the same signal. After each step, it moves its expectation a small amount in the direction of the error. The name of this method is temporal-difference learning [2].
V is correct, the prediction error of each step is the news of that step: δₜ = dₜ.A correct expectation is the mean of the money that the rest of the round pays. With a correct expectation, the prediction error of a step is the same number as the news of that step. As a result, you can calculate this prediction error from the books and the weights: it is the news.
Example: a round paid 1 stake, and the brain expects 2 stakes more: belief is 1 + 2 = 3 stakes. The next step pays 1 stake, and the brain then expects 4 stakes more: belief is 1 + 1 + 4 = 6 stakes. The news is 6 − 3 = 3 stakes. The prediction error is 1 + 4 − 2 = 3 stakes.
- A correct expectation is the mean of the money that is still to come:
V(sₜ) = E[ money after step t | events up to step t ]. - Belief is the money that the round paid up to step t, plus this expectation:
μₜ = paidₜ + V(sₜ). - Step t pays
rₜ. As a result,paidₜ = paidₜ₋₁ + rₜ. - Subtract the belief of step t − 1:
μₜ − μₜ₋₁ = rₜ + V(sₜ) − V(sₜ₋₁). - The left side is the news
dₜ. The right side is the prediction errorδₜ.
As a result, belief is more than a calculation. It is the quantity that the dopamine signal follows. The three laws of belief in Part 4 are also laws of the prediction error.
A program learned the test game with this rule only. It saw the scatters on each reel and the money of each feature. It did not see the reel strips or the paytable. The table compares its expectation with the exact belief from the reel strips. All values are in stakes, for the scatters only.
| State of the round | Exact belief | After 1,000 spins | After 100,000 spins | After 10,000,000 spins |
|---|---|---|---|---|
| Before the spin | 0.44 | 0.64 | 0.39 | 0.44 |
| 2 scatters after reel 3 | 11.58 | 30.25 | 11.76 | 11.47 |
| 2 scatters after reel 4 | 5.98 | 7.86 | 6.11 | 5.92 |
| 3 scatters: the feature starts | 64.78 | 56.70 | 75.55 | 64.43 |
After 10,000,000 spins, the largest difference is 1.4%. The mean prediction error of a step is 0.000 stakes. This agrees with Law 1: the mean news is 0.
A session of the test game has about 400 spins. No player gets to 10,000,000 spins. A real player has rough expectations from a small number of features. The sounds, the counters and the symbols of the game help the player. The exact belief is the limit that each player approaches, and it does not depend on the history of one player. For this reason, this series measures the exact belief.
Figure 1 shows two things. First, the surprise moves from the payout to the scatters. For an experienced player, the third scatter is the largest event of the round. Second, a feature can pay money and be bad news. The median feature pays 34× and the mean feature pays 64×. As a result, 70% of the features pay less than the player expects.
No guess, no signal
The formula has a consequence. The error needs an expectation, and an expectation needs something to read. A player who can read nothing has one expectation for the full round: the mean. This player gets one error, at the end.
A cue changes this. A cue is an event on the screen that changes the chance of a result, for example a scatter. With a cue, the player can guess what comes. Each guess gives an error at once, and it starts a wait for the answer. Part 7 shows how a game makes cues. Part 8 shows why their sequence holds the player.
Signal 2: the unknown result
A later experiment found a second signal in the same cells [3]. Each light gave juice with a different chance: 0, 25, 50, 75 or 100%. Between the light and the result, the activity of about 3 in 10 cells increased slowly. The increase was largest for a chance of 50%. For 0% and for 100%, it was absent.
This signal does not need a win. It needs a result that is still unknown. Scans of people show a signal of the same form in the reward areas of the brain [4]. Some scientists argue that this uncertainty, more than the win, drives the wish to gamble [5].
A simple model of this signal is the spread of the result that is still unknown. For a yes-or-no result with the chance p, the spread is p × (1 − p).
uncertainty = 4 · p · (1 − p)The value is 0 when the result is sure, and 1 when the chance is 50%. For a tease, p is the chance of the feature at that moment. Calculate it from the reel strips.
Multiply the chance by 1 minus the chance: this is the spread. Multiply the spread by 4, so that the largest value is 1.
·- Multiply the two numbers.
Example. When 2 scatters are visible after reel 2 of the test game, the chance of the feature is 0.25. The uncertainty is 4 × 0.25 × 0.75 = 0.75.
# the chance of the feature at one moment of a round, from the books that agree
same = [b for b in books if b.seen(t) == this_round.seen(t)]
chance = sum(b.weight for b in same if b.has_feature) / sum(b.weight for b in same)
uncertainty = 4 * chance * (1 - chance)Use it. If the chance before the last reel is small, the value is low and the tease is weak. Put more scatters on the last reel to increase the chance. Part 5 shows the price of this change.
In the test game, each reel with no scatter decreases the chance. Before the last reel, the chance is 9.2% and the uncertainty is 0.34. The tease becomes weaker while the player waits. The table gives the chance and the uncertainty for 3 designs.
| 2 scatters are visible | Base game | Ante | Design of Part 10 |
|---|---|---|---|
| After reel 2 | 25.0% · 0.75 | 35.3% · 0.91 | 28.6% · 0.82 |
| After reel 3 | 17.5% · 0.58 | 25.2% · 0.75 | 21.5% · 0.67 |
| After reel 4 | 9.2% · 0.34 | 9.2% · 0.34 | 13.6% · 0.47 |
Signal 3: the wish is not the pleasure
Dopamine is not a signal of pleasure. Two scientists separated two processes, and they named them "liking" and "wanting" [6]. Liking is the pleasure that a reward gives. Wanting is the pull toward the reward. Dopamine drives wanting. Rats with almost no dopamine still showed pleasure when they got sweet food, but they did not go to the food.
For a designer, this gives two different measurements. Travel and uncertainty measure the pull. They do not measure pleasure.
One study measured mood directly [7]. People selected between gambles and reported how happy they were. The mood followed the recent expectations and prediction errors. It did not follow the total of the money that the person won.
Limits of the evidence
The cell recordings come from monkeys that got juice. The studies with people used small amounts of money in a laboratory. Scientists do not agree on the cause of the slow signal [8]. The formulas in this post are simple models, and people differ.
The models are useful for one reason. They connect each signal to a quantity that a designer can calculate from the reel strips. Part 5 shows what the designer can change, and what each change costs.
Do it with an AI agent
An agent can calculate the first 2 signals from your books and your weights. You give the instructions, and you read the checks.
Read my books and my weights. Record the belief after each step: the weighted mean payout of all books that show the same facts. The facts are the number of scatters, the free spins that remain, the multiplier and the win so far. The prediction error of a step is the belief after the step minus the belief before it. For each step, print the mean prediction error and the mean size of the prediction error.
You get. Two numbers for each step. The mean prediction error is near 0, as Law 1 says: in the test game, the mean for all steps is 0.000 stakes. The mean size shows the steps that carry the surprise of your game.
Find the spins that show 2 scatters before the last reel stops. After each reel stop with 2 visible scatters, calculate the chance that the feature starts. Divide the weight of the books with the feature by the weight of all books that agree. Print the chance and the uncertainty: 4 × chance × (1 − chance).
You get. The uncertainty at each moment of a tease, from 0 to 1. In the test game, it falls from 0.75 after reel 2 to 0.34 before the last reel.
Calculate the mean payout of the feature. Count the features that pay less than this mean. Divide the result by the number of all features.
You get. The part of the features that are bad news for a player who expects the mean. In the test game, it is 70%.
References
- Schultz W, Dayan P, Montague PR (1997). A neural substrate of prediction and reward. Science 275:1593–1599.
- Sutton RS, Barto AG (2018). Reinforcement Learning: An Introduction, 2nd edition. MIT Press.
- Fiorillo CD, Tobler PN, Schultz W (2003). Discrete coding of reward probability and uncertainty by dopamine neurons. Science 299:1898–1902.
- Preuschoff K, Bossaerts P, Quartz SR (2006). Neural differentiation of expected reward and risk in human subcortical structures. Neuron 51:381–390.
- Anselme P, Robinson MJF (2013). What motivates gambling behavior? Insight into dopamine's role. Frontiers in Behavioral Neuroscience 7:182.
- Berridge KC, Robinson TE (1998). What is the role of dopamine in reward: hedonic impact, reward learning, or incentive salience? Brain Research Reviews 28:309–369.
- Rutledge RB, Skandali N, Dayan P, Dolan RJ (2014). A computational and neural model of momentary subjective well-being. PNAS 111:12252–12257.
- Niv Y, Duff MO, Dayan P (2005). Dopamine, uncertainty and TD learning. Behavioral and Brain Functions 1:6.
Next: Part 4. Belief: the value the player follows. The exact definition, three laws and four metrics.