The test game. The examples use one test game. It is not a real product. It has 5 reels and 3 rows. Three scatters start 10 free spins, and a multiplier grows after each winning spin. The RTP is 96.1%.
The first 5 parts of this series measured one round. A player does not live one round. A player lives a session. This part measures many sessions, puts them into groups, and then changes the mathematics to move sessions from one group to a different group.
One session, 12 numbers
A session has a bankroll of 100 stakes and a limit of 30 minutes. Each round is an independent draw of a book. The session stops when the time ends or when the bankroll is less than 1 stake.
Twelve numbers describe one session. This series calls them the feel vector. Some numbers measure money and time. Other numbers measure belief. Belief is the fair value of a round at one moment, from the events that the player saw.
| Number | Meaning | Mean | Median |
|---|---|---|---|
| Minutes played | The time in play, to a maximum of 30 minutes. | 18.1 min | 15.0 min |
| Net result | The end balance minus the bankroll at the start. | -16.2 × | -99.2 × |
| Largest win | The largest payout of one round. | 95.3 × | 45.4 × |
| Thrill per minute | Travel for each minute. Travel is the total movement of belief. | 87.0 ×/min | 86.3 ×/min |
| Letdown per minute | Letdown for each minute. Letdown is the fall from the best belief to the payout. | 34.9 ×/min | 34.9 ×/min |
| Delight per minute | Delight for each minute. Delight is the rise of the payout above the best belief. | 6.6 ×/min | 6.6 ×/min |
| Blank teases per minute | Teases that pay less than the stake, for each minute. | 0.8 /min | 0.8 /min |
| Longest drought | The longest time with no win of 1 stake or more. | 69.0 s | 65.0 s |
| Time to first feature | The time to the first feature. The value is 30 if no feature starts. | 10.7 min | 5.0 min |
| Features | The number of features in the session. | 2.7 | 2.0 |
| Largest drawdown | The largest fall of the balance from a peak. | 125 × | 104 × |
| Last 3 minutes | The change of the balance in the last 3 minutes. | -24.6 × | -36.6 × |
The table shows 30,000 simulated sessions of the test game. The symbol × is 1 stake.
The mean session does not exist
The mean result of a session is -16 stakes. Almost no session ends near this value. 69% of the sessions lose the full bankroll before the time ends. The other 31% last 30 minutes, and many of them end with a profit.
A mean hides these groups. A designer must know the groups, their size, and the knob that moves a session from one group to a different group. Clustering gives the groups.
Clusters: what the procedure looks for
Clustering puts vectors into k groups. Each group has a centre. Each vector belongs to its nearest centre. A good set of centres is near the sessions.
J = (1 / n) · Σᵢ ‖ xᵢ − c(i) ‖²The objective. xᵢ is the vector of session i. c(i) is its nearest centre. A small J shows that the sessions are near their centres.For each session, measure the distance to its nearest centre and square it. J is the mean of these squares. The procedure looks for the centres that make J small.
Example. 3 sessions are 1, 2 and 3 units from their centres. The squares are 1, 4 and 9. J is 14 ÷ 3 = 4.7.
J = 0
for x in sessions:
J += min(squared_distance(x, c) for c in centres)
J = J / len(sessions)Use it. Compare J only between runs on the same data with the same k. More centres give a smaller J, so J does not tell you the correct k.
This problem has the name k-means. The usual procedure for it is the algorithm of Lloyd [1]. It assigns all the sessions, moves all the centres, and does this again for 20 passes or more. This series uses e-means [2], a procedure from 2026 that gets the same J in about 2 passes.
e-means: the procedure
- Calculate the 12 numbers for each session.
- Apply a logarithm to the numbers that have a long tail.
- Subtract the mean from each number. Then divide by the standard deviation.
- Select k start centres with the k-means++ rule [3]. This rule prefers sessions that are far from the centres already selected.
- Put the sessions in a random sequence. Divide them into batches of 512 sessions.
- For one batch, assign each session to its nearest centre.
- Set each centre to a weighted mean of its old position and the mean of its sessions in the batch. A number, the step, sets the weight of the batch.
- Decrease the step from batch to batch. The last step is 0.1 of the first step.
- After 2 passes through the data, set each centre to the mean of the sessions that it got in the last pass.
- Do steps 4 to 9 with 10 different starts. Keep the result with the smallest J.
The algorithm of Lloyd reads all the sessions before it moves a centre. The e-means procedure reads a small batch, moves the centres, and reads the next batch with the better centres. The centres improve many times in one pass. The first moves are large. The last moves are small, and the centres come to rest.
Example. In this post, one pass has 58 batches of 512 sessions. The centres move 116 times in 2 passes.
for batch in shuffled(sessions, size=512):
for c in centres:
mine = [x for x in batch if nearest_centre(x) == c]
c.count = (1 - step) * c.count + step * len(mine)
c.total = (1 - step) * c.total + step * sum(mine)
c.position = c.total / c.countUse it. Do not set the batch size or the step by hand. The e-means paper gives 2 formulas that calculate them from the number of vectors, k and the number of passes.
The best position for a centre is the middle of its group. For this reason, each step of the procedure moves a centre toward the mean of its sessions.
The proof does not show that J decreases after each batch. The e-means paper gives no such proof. It gives measurements, and the check below does the same.
- For one group with n sessions and the mean m,
Σ‖x − c‖² = Σ‖x − m‖² + n·‖m − c‖². - The first term does not depend on
c. The second term is 0 whenc = m, and it is above 0 for each other centre. - As a result, the sum is smallest when
c = m. - Each centre of e-means is a weighted mean of sessions: a decayed sum of sessions divided by a decayed count. The last step of the procedure sets each centre to the mean of its sessions in the last pass.
In the selected run, e-means got J = 4.952 in 2 passes. Lloyd k-means with 10 k-means++ starts got J = 4.952, and its runs needed 17 to 56 passes. In 60 single runs of e-means, J was between 4.952 and 5.276. 6 more repeats of the procedure with 10 starts changed no share by more than 0.1 points.
The silhouette tells you how many groups to use. For one session, a is the mean distance to the sessions of its group. b is the mean distance to the sessions of the nearest other group.
s = (b − a) / max(a, b)The silhouette of one session. A value near 1 shows a clear group. A value near 0 shows a session on the border between two groups.Compare 2 distances for one session: the mean distance to its group, and the mean distance to the nearest other group. If the other group is much farther, the value is near 1. If the two distances are equal, the value is 0.
Example. The mean distance to its group is 2, and to the nearest other group it is 6. The silhouette is (6 − 2) ÷ 6 = 0.67.
Use it. Select k with the mean silhouette of all sessions. Do not select k with J.
The rule in this series is: calculate the mean silhouette for k = 3 to 7. Then select the largest k that is not more than 0.01 below the best value. The best value is 0.286. The rule selects k = 4, with 0.284.
Why e-means is the correct first tool
- You can read the result. A centre is a typical session with a value for each of the 12 numbers.
- It is fast. It needs about 2 passes through the data. Lloyd k-means needed 17 to 56 passes here. Part 11 shows the difference for 1 million rounds.
- The centres stay. You can assign the sessions of a new design to the same centres. Then the change of the shares measures the change of the feel.
- You know its limits. It prefers round groups. It has no proof that it finds the best centres. Slot data needs 2 repairs, and Part 11 shows why.
The 4 archetypes of the test game
An archetype is the centre of a group. The names come from the numbers that are far from the mean session.
No feature, 26% of sessions. The bankroll ends before a feature starts. The mean time in play is 8 minutes. The mean result is -99 stakes, with 0.0 features.
False rescue, 36% of sessions. Features start, but the bankroll ends. The mean time in play is 14 minutes. The mean result is -99 stakes, with 1.7 features.
Long ride, 28% of sessions. Features keep the session in play to the end. The mean time in play is 29 minutes. The mean result is 79 stakes, with 5.1 features.
Strong finish, 9% of sessions. The session ends with a large win. The mean time in play is 30 minutes. The mean result is 255 stakes, with 6.5 features.
The mean silhouette is 0.28. This value shows groups that touch. Archetypes are regions of one cloud of sessions. They are not fully separate types. The shares are stable. The group of one session near a border is not.
The price is fixed
Before you change the design, you must know what a design cannot change.
E[net] = −c · (1 − RTP) · E[N]. N is the number of rounds and c is the stake.The mean loss of a session is the number of rounds × the part of each stake that the game keeps. A stop rule does not change this price, if the rule uses only the rounds that the player already played.
Example: the test game keeps 3.9% of each stake. A session of 100 rounds at 1 stake loses 3.9 stakes on average.
- The result of round i is
Yᵢ = Xᵢ − c. The rounds are independent. Each round has the mean−c · (1 − RTP). - The stop rule uses only the rounds that the player already played. Mathematics calls such a rule a stop time.
- Wald's identity: for independent rounds with the same distribution and a stop time N with a finite mean,
E[Y₁ + … + Y_N] = E[N] · E[Y]. - As a result,
E[net] = −c · (1 − RTP) · E[N].
The mean session of the test game has 400 rounds. The formula gives -15.8 stakes. The simulation gives -16.2 stakes. The difference comes from the finite number of simulated sessions.
At a fixed RTP, the game keeps the same part of each stake. No mechanic changes this price. A design can change 2 things. It can change how much feel the player gets for the price. It can change which sessions pay the price.
Efficiency is the feel that a design gives for each stake that the game keeps.
E[travel] / (c · (1 − RTP))Travel is the total movement of belief in a round. This ratio is the movement that the player gets for each stake that the game keeps.
Add the travel of all rounds. Divide by the money that the game kept in these rounds.
thrill_per_loss = sum(r.travel for r in rounds) / sum(stake - r.payout for r in rounds)Use it. Compare designs that have the same RTP. The design with the larger value gives more feel for the same price.
P(the session is in play after 30 minutes)The share of sessions that do not lose the bankroll. A larger share gives more players the full time of play for the same price.
Simulate many sessions with the same bankroll and the same time limit. Count the sessions that still have money at the time limit. Divide by the number of all sessions.
lasting = [s for s in sessions if s.minutes_played >= 30]
share = len(lasting) / len(sessions)Use it. If the share is too low, decrease the volatility. The table of knobs in this post shows the effect of each knob.
the share of sessions that are nearest to each centreThe feel of the game in one small table. The centres stay the same for all designs, so you can compare the shares.
Assign each session to its nearest centre. Count the sessions of each centre. Divide each count by the number of all sessions.
for s in sessions:
counts[nearest_centre(s)] += 1
shares = [n / len(sessions) for n in counts]Use it. Keep the centres of the first design. Then a change of the shares shows what a new design does to the feel.
Designs at one RTP
The experiment changes 3 knobs of the test game:
- The number of scatters on reels 1 and 5. This sets how frequently the feature starts: 1 in 302, 1 in 151 or 1 in 94 spins.
- The number of free spins for 3 scatters: 6, 8, 10, 12, 14.
- The multiplier step for each winning spin: 0.80, 1.50, 2.29, 3.20.
Each change moves the RTP. The experiment scales the pays of the 4 low symbols until the RTP is the same again. This gives 56 designs with an RTP between 96.06% and 96.06%. The other combinations need low-symbol pays that are too small or too large.
The figure shows a trade. A design with low volatility keeps more sessions in play, and it gives less thrill for each stake lost. A design with high volatility does the opposite. The frontier is the set of the best trades.
The test game is below the frontier. 3 designs give more sessions that last and more thrill for each stake lost, at the same RTP. The test game wastes feel.
| Knob level (mean of all designs with this level) | Last 30 min | Thrill / stake lost | No feature | Volatility |
|---|---|---|---|---|
| Feature 1 in 302 spins | 46% | 87 | 35% | 6.7 |
| Feature 1 in 151 spins | 41% | 100 | 23% | 7.9 |
| Feature 1 in 94 spins | 38% | 111 | 16% | 8.3 |
| 6 free spins | 57% | 80 | 18% | 4.7 |
| 8 free spins | 46% | 91 | 20% | 6.3 |
| 10 free spins | 38% | 102 | 25% | 8.0 |
| 12 free spins | 33% | 111 | 30% | 9.6 |
| 14 free spins | 31% | 114 | 34% | 10.1 |
| Multiplier step 0.80 | 55% | 85 | 19% | 4.9 |
| Multiplier step 1.50 | 43% | 97 | 23% | 7.0 |
| Multiplier step 2.29 | 35% | 105 | 28% | 8.8 |
| Multiplier step 3.20 | 31% | 109 | 31% | 10.2 |
The table shows the mean effect of each knob. A feature that starts more frequently gives fewer sessions with no feature. A larger multiplier step gives more thrill for each stake lost and fewer sessions that last.
From a target to a design
A target is a set of limits on these numbers. This example uses 3 limits:
- Not more than 15% of the sessions are in the archetype "No feature".
- The thrill for each stake lost is not less than 95% of the value of the test game.
- The share of sessions that last 30 minutes is the largest possible.
2 of the 56 designs obey limits 1 and 2. Limit 3 selects one of them. Its feature is more frequent than the feature of the test game.
| The test game | The target pick | |
|---|---|---|
| Free spins for 3 scatters | 10 | 12 |
| Multiplier step for each winning spin | 2.29 | 0.80 |
| The feature starts | 1 in 151 spins | 1 in 94 spins |
| Pays of the low symbols | × 1.00 | × 1.03 |
| RTP | 96.06% | 96.06% |
| Volatility | 9.1 | 6.7 |
| Sessions that last 30 minutes | 31% | 41% |
| Sessions with no feature | 26% | 14% |
| Thrill for each stake lost | 108 | 104 |
| Tingle | 0.59 | 0.63 |
The RTP did not change, so the price of each round did not change. The feel changed. The share of sessions with no feature went from 26% to 14%. The share of sessions that last went from 31% to 41%. The thrill for each stake lost is 96% of the first value.
The method in 7 steps
- Write the target feel as limits on measured numbers.
- Simulate books for the design. Calculate belief for each step of each book.
- Simulate sessions. Calculate the feel vector of each session.
- Cluster the sessions of the first design. Keep the centres.
- Change one knob. Correct the RTP with a second knob.
- Assign the new sessions to the same centres. Compare the shares and the efficiency.
- Keep the designs on the frontier. Select the design that obeys the target.
Limits and correct use
Belief is the value for a player who knows the mathematics. A real player estimates it from sounds and pictures. The metrics measure the signal that the game sends.
The session model uses independent rounds, one stake and one bankroll. A real player changes the stake and can stop early. The grid has 56 designs and 3 knobs. A real game has more knobs.
The archetypes touch. Give the shares, not the group of one session. Do the clustering again when the design changes much.
These numbers measure pressure on the player as well as pleasure. Blank teases, wins smaller than the stake and a fast loss of the bankroll are in the same data. A designer or a regulator can set limits on them with the same method.
Do it with an AI agent
You give the instructions and you read the checks. The agent writes the simulation and the clustering.
Simulate 30,000 sessions of my game with a bankroll of 100 stakes and a limit of 30 minutes. For each session, record the 12 numbers of the table in this post. Take the logarithm of the amounts. Scale each number to a mean of 0 and a standard deviation of 1.
You get. A table with one row for each session and 12 columns.
Find the centres with e-means for k = 3 to 7. Use a k-means++ start, 2 passes and the distance-aware revival. Use 10 starts for each k and keep the smallest J. Select k with the mean silhouette. Print each centre and its share.
You get. A small number of typical sessions. Check: a run of Lloyd k-means on the same data does not give a J that is much smaller.
Change one knob of the game. Correct the RTP with the pays of the low symbols. Simulate the sessions again. Assign them to the old centres. Print the old shares and the new shares.
You get. The effect of the knob on the feel at the same price. Check: in each design, the mean result of a session is −(1 − RTP) × the mean number of rounds.
References
- Lloyd SP (1982). Least squares quantization in PCM. IEEE Transactions on Information Theory 28:129–137.
- Bessa S, Mazaré P-E, Szilvasy G, Touvron H, Picard D, Douze M, Jégou H (2026). e-means: outperforming k-means (in one-tenth the epochs). arXiv:2611.09501.
- Arthur D, Vassilvitskii S (2007). k-means++: the advantages of careful seeding. Proceedings of the 18th ACM-SIAM Symposium on Discrete Algorithms, 1027–1035.
Next: Part 11. Audit the books: ten types of round. The same method for single rounds.