Lucky Lenny Learning

A week with Farkle: guessing, rules, and tools

Central question: How can we tell whether a decision rule helps when dice still add luck?

This reader uses the classroom Farkle track in student_kit/, defined by docs/rules.md as farkle-classroom-v1. The engine automatically keeps scoring dice. At each decision, you choose bank or roll; you do not choose scoring dice to keep. Use a nickname if you write anything down; do not use your real name.

The Story

Monday — Guess, play, and ask

Start with a guess: when will you bank, and when will you risk another roll? Write your prediction before playing.

Play Farkle by hand with the classroom rules your instructor provides. Notice which parts come from the dice and which part is your bank-or-roll decision. A Farkle loses the points collected during that turn.

Then watch the tool tour demo. It compares a rule player, a learned player, and language-model examples. The live classroom tour shows rule and learned players; the recorded practice summary shows earlier language-model runs. These are different sources and settings. The demo is a way to ask what each tool is doing, not a promise that one tool is best.

Monday question to carry forward: Does changing a bank-or-roll rule make a difference beyond the luck of the rolls?

Wednesday — Trace one decision and edit one blank

Open student_kit/trace_my_rule.py. First predict what your function will do in each printed state. Run it and compare the state with the action. It includes turn scores just below, at, and above the starter rule's threshold, plus a case where the opponent is ahead.

Now open student_kit/my_bot.py. The function is already wired into the game. Edit its one decision rule. It receives facts such as turn score, dice remaining, your total, the target, and the opponent's score. It returns "bank" or "roll". The engine still handles the dice and automatically keeps scoring dice.

Starter sentences for your rule:

Turn one sentence into code and change one idea at a time. Then run python3 compare.py --games 10 from student_kit/. This compares your rule with R5 in both seat positions for paired seeds. Record the command and output so someone can repeat the practice run.

The program rolls, applies the game's automatic scoring-dice keep, asks for bank or roll, then continues or ends the turn. The ch05_tiny_farkle example is not present in this checkout; the kit provides the trace and comparison scripts instead.

Friday — Tournament and tools for the job

Friday is a tournament: compare your chosen bot with the listed opponents on fresh seeds, then complete the tools-for-the-job worksheet.

Practice challenge: can your edited rule beat bank-at-300 on seed start 40100? The kit's compare.py compares your function with R5, not directly with bank-at-300, so first check your rule against R5 using python3 compare.py --seed-start 40100. For a bank-at-300 comparison, use the Friday tournament setup provided by your instructor. Do not describe the R5 comparison as a bank-at-300 result.

The kit keeps the reserved judged seed block out of compare.py; follow the tournament setup for fresh Friday seeds. One practice run is not a verdict. In your worksheet, identify the rule or learned tool that fits a particular job and give a reason based on what you observed.

Dragnet: Just the Facts

What the numbers mean

All game rules and results in this reader are from the classroom variant (farkle-classroom-v1, RuleSet.classroom()): target 4,000 and no final round. The engine automatically keeps scoring dice. The player chooses bank or roll. The research game in game_mechanics is a separate track where players choose which scoring dice to keep. Do not mix its rules or results with the classroom track.

The practice tool reports wins, losses, ties, and a Wilson 95% interval for the win rate among non-tie games. It pairs seeds by playing each from both seats. Its interval treats the non-tie game outcomes as independent, so it is approximate for the paired design. A practice run does not establish a general claim. Recorded language-model data are practice only; they do not rank tools or predict a fresh-seed tournament.

A real wrong first attempt

In an earlier project report, an R5-versus-R5 control placeholder was labeled as if it were a measured candidate result. A rerun showed the candidate's actual result differed, and the report separated the control from the candidate. That mistake is why we name the opponent, command, and run behind a number instead of trusting a row label.

The Scripted Journey

Follow this sequence

Monday: write a prediction, play Farkle by hand, and watch the tool tour. Wednesday: predict the trace outputs, run trace_my_rule.py, edit my_bot.py, and run compare.py. Friday: take part in the fresh-seed tournament and complete the tools-for-the-job worksheet.

Use these starters when you write about what happened:

A real run

These commands were run from the repository root with Python 3. The comparison uses the unedited starter rule and a small practice run.

$ python3 student_kit/trace_my_rule.py
just below threshold: state={'turn_score': 299, 'dice_remaining': 4, 'total_score': 1200, 'target_score': 4000, 'opponent_score': 1100} -> action=roll
at threshold: state={'turn_score': 300, 'dice_remaining': 4, 'total_score': 1200, 'target_score': 4000, 'opponent_score': 1100} -> action=bank
just above threshold: state={'turn_score': 301, 'dice_remaining': 4, 'total_score': 1200, 'target_score': 4000, 'opponent_score': 1100} -> action=bank
opponent ahead: state={'turn_score': 300, 'dice_remaining': 2, 'total_score': 1200, 'target_score': 4000, 'opponent_score': 1500} -> action=bank
$ python3 student_kit/compare.py --games 10
Games: 10 (paired seats)
Wins: 1  Losses: 9  Ties: 0
Games per second: 177.31
Win rate on non-tie games: 10.0% (Wilson 95% interval: 1.8%–40.4%)
Different seed: try --seed-start 42000; one run can vary by chance.

The speed line is shown because the program prints it; its value is machine-dependent and is not evidence about strategy. The comparison's exact interval can be reproduced from the reported wins and losses with this Python snippet:

import math

wins, losses = 1, 9
n = wins + losses
p = wins / n
z = 1.96
d = 1 + z * z / n
center = (p + z * z / (2 * n)) / d
half = z * math.sqrt(p * (1 - p) / n + z * z / (4 * n * n)) / d
low, high = max(0.0, center - half), min(1.0, center + half)
print("Wilson 95% interval: {:.1%}–{:.1%}".format(low, high))

This was one practice run with paired seats. Its result is not the Friday tournament outcome and does not show that the starter rule is generally better or worse than R5.

Evidence table

ClaimVALUECommitted source path or reproducing commandCommit read from
Classroom rules: target and final-round behavior4,000 point target; no final rounddocs/rules.mde108e57 (origin/main path commit)
Classroom player decisionbank or roll; scoring dice kept automaticallydocs/rules.mde108e57 (origin/main path commit)
Research-game distinctionplayers choose keeps; this is a separate trackgame_mechanics/ rule documentation and engine4185667 (origin/main engine path commit); research figures are not used here
Starter rule threshold300 turn pointsstudent_kit/my_bot.pya5f6d19 (origin/main path commit)
Trace example scores299, 300, 301; opponent-ahead example has 300python3 student_kit/trace_my_rule.pythis branch (pin at merge); branch flo/ch-cs1
Trace state values4 dice; totals 1,200, target 4,000, opponent totals 1,100 and 1,500student_kit/trace_my_rule.pythis branch (pin at merge); branch flo/ch-cs1
Comparison sample size and seats10 games, paired seatspython3 student_kit/compare.py --games 10this branch (pin at merge); branch flo/ch-cs1
Practice comparison outcomes1 win, 9 losses, 0 ties (one actual practice run)Same command; output printed in The Scripted Journeythis branch (pin at merge); branch flo/ch-cs1
Practice win rate and uncertainty10.0%; Wilson 95% interval 1.8%–40.4%, among non-tiesSame command; interval formula reproduced by the printed Python snippetthis branch (pin at merge); branch flo/ch-cs1
Wilson interval method constantz = 1.96 for the 95% intervalPython snippet printed in The Scripted Journeythis branch (pin at merge); branch flo/ch-cs1
Practice seed start and suggested alternatedefault 41000; this run's suggested alternate 42000student_kit/compare.py and the printed command output7007b7f for script (origin/main path commit); output this branch (pin at merge), branch flo/ch-cs1
Friday judged seed block50000–50199 is blocked from the practice comparatorstudent_kit/compare.py7007b7f (origin/main path commit)
Challenge seed start40100python3 student_kit/compare.py --seed-start 40100; challenge framing in this readerscript 7007b7f (origin/main path commit); chapter reference this branch (pin at merge), branch flo/ch-cs1
Recorded language-model figuresPractice only; individual figures intentionally not repeated in this readerstudent_kit/recorded_llm_practice.json7007b7f (origin/main path commit)
Earlier mistaken control and correctionControl was a placeholder; candidate result was later rerun and separatedsidecar/reports/2026-11-20-duke-D-sweep.md; correction summarized in capstone/curriculum/drafts/7-the-machines.md7faf1f0 (report); b128734 (correction summary), both origin/main path commits
Machine-dependent speed177.31 games/second in this captured run; non-reproducible, excluded from claimspython3 student_kit/compare.py --games 10this branch (pin at merge); branch flo/ch-cs1

What you can now do

You can trace a bank-or-roll decision, edit the one rule in my_bot.py, compare it with R5 using a stated practice seed, and explain what the comparison does and does not show. You can also describe how a learned tool and a language model differ from a hand-written rule.

Open question: If your rule looks better in one practice comparison, what fresh comparison would help you decide whether that difference repeats? What do you predict will happen?