Ludomancy, all parts
Ludomancy, part 12 of 12 9 min read

Ludomancy 12: Field guide: use the series with an AI agent

This part has no new mathematics. It is a work method for a person who builds slot mathematics with an AI agent. It tells you what to ask for, what to check and what to change.

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

In short

  • You do not write the calculations. You give instructions to an agent, and you read the checks.
  • Each law of this series is a test. If the numbers of the agent fail a test, the numbers are wrong.
  • Each problem of feel has a number that shows it and a knob that moves it.
  • Change one knob, keep the RTP the same, and compare the same numbers again.

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. All the values in this part come from simulated rounds of this game.

Who this part is for

You build the mathematics of a slot game with an AI agent. The agent writes the simulation and the reports. You decide what the game must feel like. You did not study statistics, and you do not want to.

The other parts of this series give the reasons and the proofs. This part gives the method. Read Part 4 for the main idea and Part 11 for the audit. Then use this part as a list of work.

Five words carry all the formulas

Each formula of this series is a combination of 5 operations. The table gives each operation in words and as a program. If the books have weights, each book counts with its weight.

The text saysThe formula showsWhat you doAs a program
the mean of xE[ x ]Add x for all rounds. Divide by the number of rounds.sum(xs) / len(xs)
the chance of AP( A )Count the rounds where A is true. Divide by the number of all rounds.len(hits) / len(rounds)
if you know BE[ x | B ]Keep only the rounds where B is true. Then calculate as before.[r for r in rounds if B(r)]
the sum for all stepsΣₜ xₜAdd the value of each step of the round.sum(round.values)
the variance of xVar( x )Subtract the mean from each x. Square each difference. Calculate the mean of the squares.mean((x - m) ** 2 for x in xs)
In plain words

A formula is a short program. Read it from the inside to the outside, and say each operation in words.

Example. The formula for travel is the sum of the size of the news for all steps. In words: for each step, calculate how far belief moved. Then add these distances. In the test game, the result is 4.25 stakes for each round.

Use it. If a formula in a report has no sentence in plain words, ask the agent for one. Ask also for one example with numbers.

The work loop

All work with these metrics is one loop with 6 steps. Steps 1 to 4 make a correct measurement. Steps 5 and 6 change the game.

1. Simulate

The agent makes the books: the events of each round and its payout. 1,000,000 rounds are sufficient for a first look.

2. Record belief

After each step of each round, the agent records the fair value of the round (Part 4).

3. Measure

The agent calculates the numbers of the table "The numbers on one page" below.

4. Check

The agent prints the tests of the section "The laws are tests". Do not read a number before the tests pass.

5. Change one knob

Change one property of the game. Correct the RTP with a second property.

6. Compare

Measure again with the same code and the same centres. The difference is the effect of the knob.

The numbers on one page

Each row is one question about the game, the number that answers it, and the value of the test game.

QuestionNumberTest gameRead
What does a round cost the player?RTP: the part of the stakes that the game pays back96.1%Part 1
How wide are the results?Volatility: the standard deviation of the payout, in stakes9.1Part 2
How many wins are losses?Rounds that pay above 0 and below the stake40%Part 2
How much does a round tell the player?Travel for each round, in stakes4.25Part 4
Do the teases pay back?Tingle: delight ÷ letdown in the rounds with a tease0.59Part 4
How many teases are empty?Blank teases, as a share of all spins3.5%Part 4
How long does the money last?Sessions that are in play after 30 minutes31%Part 9
How much feel for the price?Travel for each stake that the game keeps108Part 10
Where is the dead time?Time in the types of round with little news60%Part 11

From a problem to a knob

A tester or a player describes a problem in words. The table gives the number that shows the problem and a change to test. Each change moves the RTP: correct the RTP before you compare (Part 10).

The problemThe number that shows itA change to test
Long periods with no event.The time in the types of round where news ÷ time is below 0.5 (Part 11). In the test game: 60% of the time gives 19% of the news.Make these rounds shorter. Add steps that carry news to the base game (lever 3 in Part 5).
The teases annoy the player.Tingle below 1, and the rate of blank teases (Part 4). In the test game: tingle 0.59, and 3.5% of spins are blank teases.Decrease the rate of teases, or put the chance at the tease nearer to 50% (levers 4 and 5 in Part 5).
The money ends before a feature starts.The share of sessions in the archetype "No feature" (Part 10). In the test game: 26%.Make the feature more frequent. In the grid of Part 10, a more frequent feature decreased the sessions with no feature from 35% to 16%.
A feature starts and pays little.The features that pay less than 10× (Part 11). In the test game: 14% of the features.Test more free spins with a smaller multiplier step (the grid of Part 10).
Small wins feel like losses.The rounds that pay above 0 and below the stake (Part 11). In the test game: 40% of the rounds and 13% of the money.Move this money to payouts of 1 stake or more.
The player knows the result too early.The largest news of a round ÷ its travel (the fifth number in Part 11). The value 1 shows a round with one step.Show the result in more stages, and put the largest factor last (Part 8).
In plain words

Do not change the game because of an opinion. Find the number that shows the problem. Change one knob. Measure the same number again.

Use it. No change is free. Part 5 proves that a game cannot add good news: more hope in one place is more letdown in a different place. Examine the letdown after each change.

The laws are tests

An agent can write code that runs and gives wrong numbers. The laws of this series protect you. A correct calculation obeys each law, so each law is a test. Tell the agent to print the tests with each report.

TestA correct resultA failure shows
The priceThe mean payout ÷ the price of the round is the RTP of the design.The simulation or the weights are wrong.
Law 1 (Part 4)The mean news of each step is 0.A fact that changes the value of the round is not in the list of facts, or a group of books is too small.
Law 2 (Part 4)The mean of the sum of the squared news is the variance of the payout.A step is not in the record, or the last belief is not the payout.
Law 3 (Part 4)In each round, travel is not smaller than the size of the payout minus the first belief.The news of a round does not add up to its result.
The price of a session (Part 10)The mean result of a session is −(1 − RTP) × the mean number of rounds.The session code changes the stake or counts the rounds incorrectly.
The shares (Part 11)The shares of the rounds, the time, the money and the news each add up to 100%.A book is in 2 types or in no type.
The rare types (Part 11)The rounds with a feature have clusters of their own.The clustering removed a small cluster. Use the distance test.

The tests that use a mean have the error of a simulation. More rounds make the error smaller. Tell the agent to print the error with the result.

A brief for your agent

Give this text to the agent at the start of a project. It contains the definitions, the tests and the rules of work. The instructions at the end of each part of this series give the detail for one topic.

PROJECT BRIEF: FEEL METRICS FOR SLOT MATHEMATICS

WORDS
- Stake: the price of one spin. Give all amounts in stakes.
- Book: the record of one round: its events in sequence and its payout.
- Weight: how frequently the game selects a book.
- Step: one event that the player can see (a reel stop, a cascade, a free spin).
- Belief after a step: the weighted mean payout of all books that show the
  same facts to the player up to that step. Facts: the number of scatters,
  the free spins that remain, the multiplier, the win so far.
  Do not use the full screen as a fact.
- News of a step: belief after the step minus belief before the step.
- Tease: a spin that shows that the feature is possible before the last reel stops.

NUMBERS FOR EACH ROUND
- travel  = the sum of the sizes of the news
- letdown = max(0, highest belief before the end - payout)
- delight = max(0, payout - highest belief before the end)

NUMBERS FOR THE GAME, FOR EACH BET MODE
- RTP, volatility, the share of rounds that pay above 0 and below the stake
- travel for each round and for each minute
- tingle = sum of delight / sum of letdown, in the rounds with a tease
- blank teases = teases that pay less than the stake, as a share of all spins
- sessions (bankroll 100 stakes, limit 30 minutes): the share that lasts,
  the loss for each minute, the travel for each stake lost

TESTS. Print each test. Stop if a test fails.
1. Mean payout / price of the round = the RTP of the design.
2. The mean news of each step is 0.
3. The mean of the sum of the squared news = the variance of the payout.
4. In each round, travel >= the size of (payout - first belief).
5. The mean result of a session = -(1 - RTP) x the mean number of rounds.
6. Each set of shares adds up to 100%.
Tests 1, 2, 3 and 5 have the error of a simulation. Give the error with the result.

CLUSTERS
- Encode each round as 8 numbers and each session as 12 numbers.
- Take the logarithm of the amounts. Scale each number to a standard deviation of 1.
- Find the centres with e-means (arXiv:2611.09501). Use a k-means++ start,
  2 passes, and the distance-aware revival (arXiv:2611.18238).
- Keep the centres and the scale. Assign each new version of the game to them.

RULES OF WORK
- Change one knob in one experiment. Correct the RTP before you compare.
- Calculate belief again after each change of the weights.
- Give each number with the count of rounds that it comes from.

Limits

Belief is the value for a player who knows the mathematics. A real player estimates it from sounds and pictures. The numbers measure the signal that the game sends. They do not measure what one player feels.

All the values in this series come from one test game. Your game gives different values. Use the method, and do not copy the values as targets.

The same numbers show pressure on the player: blank teases, wins below the stake and a fast loss of the bankroll. Set limits on these numbers before you tune the game (Part 5).

This is the last part of the series.