Ludomancy, all parts
Ludomancy, part 8 of 12 15 min read

Ludomancy 8: The feed: why a sequence of cues holds the player

One cue gives the brain one signal. A sequence of cues gives a signal at each step and a wait between the steps. The order and the size of the steps decide how much the brain gets from the same money.

Part 8 of 12 in Ludomancy. Each part stands on its own: it explains the test game and defines the terms it uses.

In short

  • Each stage that a round passes multiplies belief. In the test game, the good news grows from stage to stage, and the game pays nothing more.
  • Good news makes the wait after it more valuable. For this reason, a cue comes first and a pause comes after it.
  • For a fixed budget, equal steps give the most movement. A cue that tells too much uses the budget in one step.
  • The prediction error teaches. In a game of chance, the error does not go to 0, and the lesson does not end.

The test game. This series uses one test game, which is not a real product. Three scatters on its 5 reels start 10 free spins, about 1 time in 151 spins. Belief is the fair value of the round after each step. News is the change of belief in one step. A cue is an event on the screen that changes what the player expects.

One cue or a feed

Part 7 shows that a cue moves news to an earlier step. A feed is a sequence of cues in one round. Examples are 3 scatters on 5 reels, a multiplier that grows, and a mystery symbol that opens.

The same money can come as one piece of news or as a feed. This post shows why the brain gets more from the feed, and why a feed holds the player.

Each stage multiplies belief

Many results need more than one event. The feature of the test game needs 3 scatters. Call each necessary event a stage.

Claim
Let a result need n stages. Let stage j succeed with the chance qⱼ. When the round passes stage j, belief multiplies by 1 ÷ qⱼ.
In plain words

Each time the round passes a stage, divide the belief by the chance of that stage. A stage with a chance of 1 in 4 multiplies belief by 4.

Example: a feature pays 80× on average and needs 3 stages, each with a chance of 1 in 2. Belief is 10× before the first stage, then 20×, then 40×, then 80×: each stage multiplies it by 1 ÷ 0.5 = 2.

Proof (you can skip it)
  1. Let the result pay V on average. Before stage j, the belief is V × qⱼ × qⱼ₊₁ × … × qₙ.
  2. After stage j succeeds, the belief is V × qⱼ₊₁ × … × qₙ.
  3. The ratio of the two values is 1 ÷ qⱼ. In bits, the step is log₂(1 ÷ qⱼ).
  4. The product of all qⱼ is P(result). As a result, the bits of all stages add up to log₂(1 ÷ P(result)).
∎

Each stage is a step of the same type: belief multiplies. But each stage multiplies a larger belief. If no stage has a larger chance than the stage before it, the good news in stakes grows from stage to stage. The game pays nothing more for this growth. It comes from the sequence.

In plain words

Stages with the same chance multiply belief by the same number, but a later stage multiplies a larger belief.

qⱼ
The chance that the round passes stage j, from 0 to 1.
1 ÷ qⱼ
The number that multiplies belief when the round passes stage j.

Example. In the round of Figure 1, the chance of the third scatter on reel 5 is 9.2%. When it lands, belief for the scatters only goes from 5.98× to 64.78×: 64.78 ÷ 5.98 = 10.83, which is 1 ÷ 0.0923.

belief = belief_before_first_stage
for chance in stage_chances:
    news = belief / chance - belief    # the good news of this stage
    belief = belief / chance

Use it. If you want the steps to grow, do not give a later stage a larger chance than an earlier stage.

Good or bad newswhen the reel stops,in bitsUncertaintywhile the playerwaits for the reel−1.2 bits−0.3×0.03Reel 1chance 0.3%S+3.1 bits+1.4×0.01Reel 2chance 2.4%−1.5 bits−1.0×0.09Reel 3chance 0.8%S+3.5 bits+5.4×0.03Reel 4chance 9.2%S+3.4 bits+58.8×0.34Reel 5chance 100%
Figure 1. One round of the test game as a feed, with scatters on reels 2, 4 and 5. Top: the information of each reel stop in bits, and the news in stakes. Bottom: the uncertainty while the player waits for that reel. In bits, the 3 steps of good news are almost equal. In stakes, they grow: 1.4×, 5.4×, 58.8×.
Check with numbers

The reel strips give the chance of the feature after each reel of this round. The steps give −1.23, +3.05, −1.49, +3.46, +3.44 bits. The sum is 7.23 bits. The chance before the spin is 1 in 150.6, and log₂ of 150.6 is 7.23.

A result with a chance of 1 in 151 contains 7.2 bits. A stage with a chance of 50% gives 1 bit, and it has the largest uncertainty (Part 3). As a result, this feature has room for 7 such stages. The test game uses 3 scatters. Its last stage gives 3.4 bits with a chance of 9.2%.

In plain words

Write the chance of the result as 1 round in a number of rounds. 1 bit cuts this number in half, and the bits of the result are the count of halvings down to 1. A step that makes the result less probable has bits below 0.

Example. The feature of the test game comes in 1 of 151 rounds: 7 halvings give 1.2, and the exact count is 7.2 bits.

import math
bits_of_result = math.log2(1 / chance_of_result)
bits_of_step = math.log2(chance_after_step / chance_before_step)
# in a round that gets the result, the bits of all steps add up to bits_of_result

Use it. If you want more stages, give each stage a larger chance, or make the result more rare.

The order of the reveals

Many features start with a feed of reveals: the number of free spins, then a multiplier, then a special symbol. Each reveal shows one factor of the payout.

Claim
Let the payout be a product of independent factors. Let the game show one factor at each step. Then a factor releases more variance when the game shows it later.
In plain words

A factor releases more variance when the game shows it later. After a good first reveal, the next step is large, and large steps count more in the variance.

Example: the payout is factor A × factor B, and each factor is 1 or 3 with the same chance. Belief starts at 4×, and the first reveal moves it by 2×, to 2× or to 6×. The second reveal moves belief by 1× from 2×, or by 3× from 6×. The mean squared step grows from 2 × 2 = 4 to (1 × 1 + 3 × 3) ÷ 2 = 5.

Proof (you can skip it)
  1. Write each factor as its mean times a relative factor fⱼ with a mean of 1. Then μ₀ is the product of the means.
  2. After step t, the belief is μ₀ × f₁ × … × fₜ. The news of step t is μ₀ × f₁ × … × fₜ₋₁ × (fₜ − 1).
  3. The factors are independent. The variance of step t is μ₀² × E[f₁²] × … × E[fₜ₋₁²] × Var(fₜ).
  4. Each E[fⱼ²] is 1 or more. As a result, each earlier factor multiplies the variance of step t.
∎
Check with numbers

Take a variant of the feature of the test game. The game draws the number of free spins from 6, 10, 14. It draws the multiplier step from 0.8, 2.29, 3.20. It shows the two values before the first spin. The value tables give the exact belief after each reveal, in squared stakes.

RevealVariance if it comes firstVariance if it comes second
Number of free spins13751633
Multiplier step685942

The two reveals release 2318 squared stakes in each order. This feature is not an exact product of the two factors, but the direction is the same.

The order decides the form of the feed. Multiplier first: 685 and then 1633, and the variance of the steps grows. Free spins first: 1375 and then 942, and the variance of the steps decreases. The money is the same.

A pause after good news

A positive prediction error has a second effect. In one model, it makes the wait for the reward more valuable [1]. The model explains an observation. Animals and people select early information about a reward, although the information does not change the reward [2].

A second study recorded rats that ran to a reward. Dopamine increased gradually as the animal came nearer [3]. A feed uses the two effects. A cue gives good news. Then a pause lets the wait work. Then the next cue comes.

A mystery symbol is a cue of a special type. It tells the player that a result exists, and it hides the result. Curiosity is the wish to close such a gap [4]. In one study, curiosity was highest when people were not sure of the answer, and it activated a reward area of the brain [5].

Equal steps give the most movement

Claim
Let n steps release the variance v₁ … vₙ, with the total Var. Then Σ √vₜ ≤ √(n × Var). The two sides are equal only when all steps are equal.
In plain words

The square root of the variance of a step is the typical size of its news. For a fixed total variance, the sum of these sizes is largest when each step releases the same variance.

Example: 4 steps release a total variance of 100. Equal steps of 25 give 5 + 5 + 5 + 5 = 20, which is the largest possible sum. One step of 100 and 3 steps of 0 give only 10 + 0 + 0 + 0 = 10.

Proof (you can skip it)
  1. √vₜ is the typical size of the news of step t.
  2. The Cauchy–Schwarz inequality gives (Σ √vₜ × 1)² ≤ (Σ vₜ) × (Σ 1²).
  3. The right side is Var × n. Take the square root of the two sides.
  4. The inequality is an equation only when all vₜ are equal.
∎
Evenness of a feed0.95 for the 10 free spins of the test game
evenness = Σ √vₜ ÷ √(n × Σ vₜ)

The value is 1 when each step releases the same variance. It is 1 ÷ √n when one step releases all of it. For 10 steps, that minimum is 0.32.

In plain words

For each step, calculate the mean of the squared news for all rounds. Add the square roots of these means. Divide by the square root of this product: the number of steps × the sum of the means.

vₜ
The variance that step t releases: the mean of the squared news of step t for all rounds.
n
The number of steps.
from math import sqrt
v = [sum(r.news[t] ** 2 for r in rounds) / len(rounds) for t in range(steps)]
evenness = sum(sqrt(x) for x in v) / sqrt(steps * sum(v))

Use it. If the value is low, one step tells too much: move a part of its information to other steps.

A cue that tells too much breaks this rule. Part 7 describes a cue at the start of a large feature. Assume that the test game shows it when the feature will pay 100× or more. This one cue releases 51% of the variance of the feature. The 10 free spins share the other 49%.

The cue also has a price in bad news. It appears in 18% of the features. In the other 82%, its silence moves belief from 64× down to 33× before the first spin.

The end weighs most

Equal steps give the most movement. But memory does not weigh all steps equally. In a study of pain, memory kept the worst moment and the end [6]. In studies of choice, most people preferred a sequence that improves [7]. This series assumes the same for a feature: the largest step is best at the end.

0%5%10%15%20%25%12345678910Free spinShare of the varianceMultiplies by 1.5Jumps at 3, 6 and 9 winsAdds a fixed amountNo growth
Figure 2. The share of the variance that each of the 10 free spins releases, for 4 growth laws of the multiplier. Each law gives the same mean payout. With no growth, each spin releases the same share. With growth, the last spins release the most.

A multiplier that grows moves the release to the end. With no growth, the last 3 of the 10 spins release 29% of the variance. With the multiplier of the test game, they release 54%. The evenness decreases only from 1.00 to 0.95.

Check with numbers

The simulation ran 200,000 features for each law. For the test game, the steps release 8471 squared stakes, and the variance of the feature payout is 8468. Growth also makes the budget larger. The variance is 4978 with no growth and 20552 with a multiplier that multiplies by 1.5.

Why a feed holds the player

The two signals of Part 3 need a guess. The table compares 3 games that pay the same money.

What the player can guessPrediction errorUncertainty signalWhat the brain learns
Nothing. The game has no cue.One, at the payoutNone before the payoutNothing. No event predicts the payout.
All. Each cue gives a sure result.None, after the player learns the cuesNoneAll. Then the signal stops.
A part. Each cue gives a chance.One at each cueIn each waitA part. The lesson does not end.

A slot game with a feed is the third game. Its cues are real, and chance decides each result. The player can guess, and the guess is never sure.

The prediction error is more than a sensation. It is a signal that teaches [8]. It has three effects on a player.

  • The cue gets a pull. While an animal learns, the dopamine signal moves from the reward to the cue. In rats that go to the cue, this change needs dopamine. After it, the cue itself attracts the animal [9].
  • Chance keeps the lesson open. If a reward is sure, the error goes to 0 and the signal stops. In a game of chance, the result of each round is new, and the error cannot go to 0. In the program of Part 3, the mean size of the error was still 0.44 stakes for each step after 10,000,000 spins. Rats that got an uncertain reward went to the cue more than rats that got a sure reward. The effect was clearest when the chance and the size of the reward were uncertain [10].
  • A guess can feel like skill. An early study reported that a choice made people more sure of success in a task of pure chance [11]. A large later study did not find this effect of choice [12]. For near misses, the evidence is more specific. A near miss increased the wish to continue only when the player made the choice [13].

These effects explain the title of this post. A feed lets the player guess at each step. Each guess gives an error. Each error teaches. And chance makes sure that the lesson does not end.

A duty

The same effects can hold a player longer than the player wants. For this reason, a designer must measure the feed. Count the cues, their reliability and their bits. Use no false cue (Part 7). Set a maximum for the cues that end with nothing.

Do it with an AI agent

You do not write the calculation. You give the instructions, and you read the checks. The checks are the laws of this post.

Give this to your AI agent
  1. List the stages that a round of my game must pass to start the feature, in sequence. Simulate 1,000,000 rounds. For each stage, count the rounds that come to the stage and the rounds that pass it. All rounds come to the first stage. The chance to pass is the second count divided by the first count. Print the chance and the bits of each stage: the bits are log2(1 ÷ chance).

    You get. A table of the stages. Check 1: the product of all the chances is equal to the chance of the feature in all rounds. Check 2: the bits of all stages add up to log2(1 ÷ chance of the feature). For the test game, that sum is 7.2 bits.

  2. Calculate the mean payout of the feature. Belief before a stage is this mean × the chances of all stages that remain. When the round passes a stage, divide the belief by the chance of that stage. The news of the stage is the belief after it minus the belief before it. Print the belief and the news of each stage in stakes.

    You get. The size of the good news at each stage. Check: the last belief is the mean payout of the feature. In the round of Figure 1, the 3 scatters of the test game give news of +1.4×, +5.4×, +58.8×.

  3. Simulate 200,000 features. Record the belief after each step of each feature. Belief is the mean payout of all features that show the same facts to the player up to that step. Use these facts: the free spins that remain, the multiplier, the win so far. The news of a step is the belief after it minus the belief before it. For each step, print the mean of the squared news and its share of the total.

    You get. The variance that each step releases. Check: the sum of these means is almost equal to the variance of the feature payout. For the test game, the two values are 8471 and 8468 squared stakes.

  4. Calculate the evenness of the feed from these means. Add the square roots of the means. Divide by the square root of (the number of steps × the sum of the means). Also print the share of the last third of the steps in the sum of the means.

    You get. Two numbers for the form of the feed. For 10 steps, the evenness is between 0.32 and 1. The free spins of the test game have an evenness of 0.95, and the last 3 of the 10 spins release 54% of the variance.

References

  1. Iigaya K, Story GW, Kurth-Nelson Z, Dolan RJ, Dayan P (2016). The modulation of savouring by prediction error and its effects on choice. eLife 5:e13747.
  2. Bromberg-Martin ES, Hikosaka O (2009). Midbrain dopamine neurons signal preference for advance information about upcoming rewards. Neuron 63:119–126.
  3. Howe MW, Tierney PL, Sandberg SG, Phillips PEM, Graybiel AM (2013). Prolonged dopamine signalling in striatum signals proximity and value of distant rewards. Nature 500:575–579.
  4. Loewenstein G (1994). The psychology of curiosity: a review and reinterpretation. Psychological Bulletin 116:75–98.
  5. Kang MJ, Hsu M, Krajbich IM, Loewenstein G, McClure SM, Wang JT-Y, Camerer CF (2009). The wick in the candle of learning: epistemic curiosity activates reward circuitry and enhances memory. Psychological Science 20:963–973.
  6. Kahneman D, Fredrickson BL, Schreiber CA, Redelmeier DA (1993). When more pain is preferred to less: adding a better end. Psychological Science 4:401–405.
  7. Loewenstein GF, Prelec D (1993). Preferences for sequences of outcomes. Psychological Review 100:91–108.
  8. Schultz W, Dayan P, Montague PR (1997). A neural substrate of prediction and reward. Science 275:1593–1599.
  9. Flagel SB, Clark JJ, Robinson TE, Mayo L, Czuj A, Willuhn I, Akers CA, Clinton SM, Phillips PEM, Akil H (2011). A selective role for dopamine in stimulus–reward learning. Nature 469:53–57.
  10. Anselme P, Robinson MJF, Berridge KC (2013). Reward uncertainty enhances incentive salience attribution as sign-tracking. Behavioural Brain Research 238:53–61.
  11. Langer EJ (1975). The illusion of control. Journal of Personality and Social Psychology 32:311–328.
  12. Klusowski J, Small DA, Simmons JP (2021). Does choice cause an illusion of control? Psychological Science 32:159–172.
  13. Clark L, Lawrence AJ, Astley-Jones F, Gray N (2009). Gambling near-misses enhance motivation to gamble and recruit win-related brain circuitry. Neuron 61:481–490.

Next: Part 9. Sessions: feel in time and money. The feed of each round adds up to time and money.