Book 3: How Computer Players Decide
The Story
Imagine two computer players at the same table. Both follow the same dice rules. One rolls without much of a plan. The other seems to know when to stop. A third can calculate the best choice for the turn. Which one is actually better?
That question sounds simple until we ask what “better” means. Does it mean earning more points in one turn? Winning more complete games? Making the same choice as a careful human player? Those are different goals, and a result for one goal does not automatically answer the others.
This chapter follows four ways to make decisions in Farkle. R0 is a random player. R5 is a human-style player that uses a written set of rules. The exact solver calculates which legal choice has the highest expected points for the current turn. A threshold player learns simple score cutoffs from examples of the solver’s choices. These are not four levels on one universal ladder. Each is a different recipe, and our measurements ask different questions about them.
The track here is the research game, implemented in game_mechanics. We report results separately for RuleSet.traditional() and busche_neller. The traditional rules use a final round; Busche–Neller does not. We do not combine their scores or treat them as one ruleset. The chapter uses committed experiments, not classroom-variant data.
Dragnet: Just the Facts
What can a player choose?
During a turn, a player rolls dice and may keep scoring dice. After a legal keep, the player chooses whether to bank the turn’s points or roll again. Banking ends the turn and adds its points to the player’s game total. Rolling again might earn more, but a Farkle—a roll with no scoring dice—loses the points built during that turn. This is a compact decision problem: observe the state, choose an action, and accept what the dice produce.
The word state means the information needed to decide what to do now. For this turn model, it includes the number of dice left and the points already accumulated in the turn. A keep choice also depends on the scoring dice just rolled. A policy is simply a rule for selecting an action from a state.
Four decision recipes
R0, the random player. When choosing dice to keep, R0 picks uniformly among indexed legal keep combinations. Because identical dice occupy separate positions, some resulting keeps can be represented by more indexed combinations and are therefore more likely. After a keep, R0 picks uniformly between bank and roll when both are legal; in rule sets that set an opening minimum, it must roll until that minimum is met. The traditional and Busche–Neller experiments in this chapter do not use an opening minimum. It provides a useful baseline: if a more elaborate player cannot do better than random play, something is wrong with the policy or the experiment. In 100,000 solitaire turns, R0 averaged 211.1505 points per turn under traditional rules and 183.9470 under Busche–Neller. Those are averages of isolated turns, not win rates.
R5, the human-style rules player. R5 follows a hand-written rule book. It is a more purposeful comparison than random play: its choices resemble practical rules a person might use, but they are not guaranteed to be mathematically best. R5 averaged 527.3925 points per turn in traditional and 398.5290 in Busche–Neller in the same gap experiment. It chose the same bank-or-roll action as the exact solver on 94.42% of its observed traditional decisions and 96.21% of its Busche–Neller decisions. That agreement only checks the bank-or-roll part; it does not say that R5’s keep choice is equally strong.
The exact one-turn solver. “Exact” means that the solver evaluates the available choices using the game’s probability model rather than estimating them from a small random sample. It calculates expected points for the rest of the current turn, then chooses the option with the highest value. An expected value is a probability-weighted average of possible outcomes. The solver’s exact expected turn scores are 583.1696 for traditional and 446.5714 for Busche–Neller. In the simulated 100,000-turn runs, its averages were 581.6170 and 444.6005. A simulation average can differ from the exact expectation because a finite batch of dice rolls varies by chance. The solver is exact for a capped model: turn totals at or above 10,000 are treated as banked. As its docstring puts it, “Values are exact for this capped model and understated near the cap.”
This solver has a deliberately narrow objective. It maximizes points for one turn; it does not calculate the probability of winning the whole game. In the full-game comparison against R5, the solver won 5,885, R5 won 4,011, and 104 games tied under traditional rules. The games were paired by seed, with two seat-reversed games per seed: each seed was played once with the solver in each seat, with the seat order reversed for the second game; later dice are not guaranteed to be identical. Its win share, with ties excluded, was 59.5% (95% interval 58.4% to 60.5%). A 95% interval is a range calculated by the report’s method that expresses uncertainty in the estimated win share; repeating the experiment this way would produce intervals covering the underlying share about 95% of the time. Under Busche–Neller, it won 6,922 games, R5 won 3,078, there were no ties, and its win share was 69.2% (68.2% to 70.3%). So the points optimizer does beat R5 in these full-game comparisons. But this does not make it a win-probability optimum. “Points per turn” is NOT “probability of winning.” To find the best win strategy, we would need a solver whose objective is the chance of winning a game, and that reference is not part of this evidence.
Where R5 loses ground: the keep choice
A turn has two linked decisions: which scoring dice to keep, and whether to bank or roll afterward. To see which part matters more, the keep-ladder experiment made four combinations. Bot A used R5 for both decisions. Bot B kept dice using the solver but kept R5’s bank rule. Bot C used the solver’s bank rule but kept R5’s dice choice. Bot D used the solver for both.
In traditional rules, switching only the keep choice improved the mean by B−A = 42.3568 points per turn. Switching only the bank rule improved it by C−A = 3.8421 points per turn. The keep-choice change is much larger in this comparison. Under Busche–Neller, the same pattern appears: B−A = 40.5206, compared with C−A = 2.4682. This is evidence that R5’s keep choice, rather than its bank rule, accounts for most of the gap in this experiment. It is not a claim that the bank decision never matters; the differences are measured within a particular ruleset and turn setup.
Learning a short rule from examples
Can we imitate a good decision without carrying the full solver into every game? A threshold learner tries. It looks at examples labelled with the solver’s preferred action, “bank” or “roll,” and finds a score cutoff for each number of dice. A cutoff is easy to explain: at or above this accumulated score, bank; below it, roll. Training means choosing those cutoffs from one set of examples. A separate judge set checks the learned choices on examples held aside from training.
Under traditional rules, the fitted thresholds for one through six dice were 251, 101, 351, 1001, 3051, and 9951. On the judge examples, the threshold learner agreed with solver labels on 92.1426% overall. Its 100,000-turn mean was 533.8715 points, with a 95% interval half-width of 3.3188. For comparison, the R5 mean in the baseline experiment was 527.3925; subtracting the threshold mean gives −6.4790. The baseline report’s −6.4815 used a two-decimal R5 reference of 527.39. This is still a points-per-turn result, not a game-win result.
Busche–Neller has a separately fitted set of cutoffs: 201, 201, 351, 951, 2501, and 7501 for one through six dice. Its judge agreement was 99.9707%, and its mean was 400.4165 points per turn, with a 95% interval half-width of 1.9719. The near-perfect agreement is a property of this held-out decision set and these features; it does not prove that thresholds are universally optimal or that this ruleset is easier in every sense. The separate fits matter: a threshold learned for one ruleset should not be silently reused for the other.
Agreement and score answer different questions. Agreement is the fraction of judge decisions matching the solver’s label. It treats each judged decision as right or wrong relative to those labels. Points per turn measures the average outcome when a policy is played. A player can match labels often yet miss some high-impact choices; it can also make a few different choices without much score change. Neither metric by itself tells us the probability of winning a full game.
The real mistake
One earlier keep-data attempt split examples using the state before a keep. The original F5b summary already warned that its pre-keep split was not value-disjoint. That seemed like a reasonable way to keep training and judge states separate, but the same resulting state after a keep could still appear on both sides of the split, letting related information cross the boundary. Commit fa6358d changed the split to group by resulting states and drop mixed pre-keep states; the code describes it as a “Closure split on the post-keep state.” It is a useful warning: splitting data is not automatically safe just because the row labels differ. We have to ask what information rows share.
The Scripted Journey
This short Python program uses only the standard library. It opens the committed gap report and prints the raw mean and interval columns, without rounding or rerunning a simulation. Run it from the repository root as python3 -c '...program...'; the code below is the same program used to produce the output.
import csv
with open("artifacts/gap_v1/points_per_turn.csv", newline="") as source:
rows = csv.DictReader(source)
print("rules,bot,mean_points,ci95_half_width,farkle_turn_rate")
for row in rows:
print(
",".join(
row[key]
for key in (
"rules",
"bot",
"mean_points",
"ci95_half_width",
"farkle_turn_rate",
)
)
)
Actual output:
rules,bot,mean_points,ci95_half_width,farkle_turn_rate
traditional,exact,583.1696,,0.205810
traditional,R0,211.1505,1.7208,0.205670
traditional,R5,527.3925,3.2098,0.161980
traditional,solver,581.6170,3.4676,0.206150
busche_neller,exact,446.5714,,0.205964
busche_neller,R0,183.9470,1.2547,0.212480
busche_neller,R5,398.5290,1.9172,0.178770
busche_neller,solver,444.6005,2.1538,0.206380
Read one row at a time. The first field names the rules. The second names the player. mean_points is its average for one turn. ci95_half_width describes the half-width of the reported 95% interval; the exact reference rows have no interval because they are calculated rather than sampled. The last field is the fraction of turns that ended in a Farkle. Notice how the exact expected score and the simulated solver mean are close but not identical. Also notice that R0, R5, and the solver have their own Farkle rates: a larger average does not mean the player never takes a risk.
The table comes from committed data, so it is quick to inspect and reproducible without heavy computation. Try changing the selected columns or adding a filter for just one ruleset. Before interpreting a new number, say out loud what it measures: a per-turn mean, an agreement rate, a Farkle rate, or a full-game win share. Those quantities have different units and cannot be substituted for one another.
What you can now do
You can distinguish a random baseline, a hand-written policy, an exact one-turn points optimizer, and a threshold rule learned from examples. You can read an agreement score without mistaking it for playing strength, compare keep and bank choices using B−A and C−A, and keep per-turn points separate from full-game wins. You can also explain why the exact solver beating R5 does not establish that it is the best possible game-winning policy.
For this account, I read game_mechanics/strategy/bots.py and game_mechanics/strategy/solver.py; those files support the descriptions of R0’s choices and the solver’s capped probability model above.
Evidence table
| Claim | Value | Artifact path | Commit hash |
|---|---|---|---|
| R0, R5, exact and simulated solver means, 95% half-widths, and Farkle-turn rates; gap experiment used 100,000 turns with seed 20260 for each player and ruleset | Values reproduced in text and scripted output exactly as CSV fields | artifacts/gap_v1/summary.md; artifacts/gap_v1/points_per_turn.csv | 926f10b |
| R5 bank-or-roll agreement and keep-choice agreement | traditional 94.42%, keep same-value 64.77%; busche_neller 96.21%, keep same-value 63.75% | artifacts/gap_v1/summary.md; artifacts/gap_v1/agreement.csv | 926f10b |
| Keep-ladder means and paired changes B−A and C−A | traditional B−A 42.3568, C−A 3.8421; busche_neller B−A 40.5206, C−A 2.4682 | artifacts/keep_ladder_v1/summary.md; artifacts/keep_ladder_v1/points_per_turn.csv | 2d9695c |
| Threshold cutoffs, judge agreement and threshold points-per-turn results | traditional cutoffs 251, 101, 351, 1001, 3051, 9951; 92.1426%; mean 533.8715, half-width 3.3188. busche_neller cutoffs 201, 201, 351, 951, 2501, 7501; 99.9707%; mean 400.4165, half-width 1.9719 | artifacts/t_baselines_v1/points_per_turn.csv; artifacts/t_baselines_v1/agreement.csv; sidecar/reports/2026-11-20-grace-T-baselines.md | 40bdc10 |
| Full-game solver versus R5 outcomes and paired win shares | traditional: 10,000 games, 5,885 solver wins, 4,011 R5 wins, 104 ties; 59.5% (58.4% to 60.5%). busche_neller: 10,000 games, 6,922 solver wins, 3,078 R5 wins, 0 ties; 69.2% (68.2% to 70.3%) | artifacts/solver_vs_r5_v1/summary.md; sidecar/reports/2026-11-20-solver-vs-r5.md | 46bdc67 |
Script output is a direct CSV read; command is python3 -c containing the snippet above | Exact printed rows shown in The Scripted Journey | artifacts/gap_v1/points_per_turn.csv plus the displayed script | 926f10b |
| Earlier keep-data split leaked related post-keep states across the boundary; repair changed to closure split on next states | Repair commit verified on origin/flo-maise/F5b-keep-data | Git commit fa6358d, scripts/whatif_keep_data.py | fa6358d |
| Exact one-turn solver turn-total cap | Totals at or above 10,000 are banked | game_mechanics/strategy/solver.py:12-16,31,92-100 | fc7e36d |
| Threshold experiment sample size | 100,000 turns per learner and ruleset | artifacts/t_baselines_v1/points_per_turn.csv:2,5 | 40bdc10 |
| Threshold mean minus exact R5 mean in traditional rules | −6.4790 points per turn (527.3925 − 533.8715) | artifacts/gap_v1/points_per_turn.csv:4; artifacts/t_baselines_v1/points_per_turn.csv:2; command: python3 -c 'print(f"{527.3925 - 533.8715:.4f}")' | 926f10b; 40bdc10 |
| Rounded traditional R5 reference in the baseline report | 527.39 points per turn | artifacts/gap_v1/summary.md:14 | 926f10b |
| Baseline threshold regret versus rounded traditional R5 reference | −6.4815 points per turn | artifacts/t_baselines_v1/points_per_turn.csv:2 | 40bdc10 |
One unanswered question: if a player could maximize the chance of winning the whole game, what would you predict it would do differently from this points-per-turn solver?