Chapter 40 Instructor Notes: Capstone: Your Complete Chess Analysis and Improvement Toolkit

Chapter text · Case study 1 · Case study 2 · Exercises · Quiz · Key takeaways · Outpost README · Capstone rubric

The capstone wires the forty-one Outpost modules into seven commands, an HTML report and a 65-test suite. It then asks one question of two players: does the data find the weakness the player expected? For Dev (a composite) the answer is no. His Najdorf is noise, and the data points, moderately, at quiet middlegame "plans and calculation" blunders. For GothamChess (a real public archive) the answer is also no: the clock is a net asset. The payoff is not a discovery. It is learning to refuse a false certainty, including the new one the data seems to offer.

Remind the class that Dev and Lena are composites:

🎭 Dev's games are real Lichess games played by anonymous players at his rating, assembled into one "player" so we can demonstrate the method. Nothing here is a fact about a real person.

GothamChess is a public figure analysed through his public account. Opponents are never named, and nothing in the chapter is a claim about how he plays over the board.

Learning objectives

By the end, students should be able to:

  1. Run the full pipeline (import → analyze → review → repertoire → scout → progress → report) on a composite, a public account or their own PGN, and explain what each workspace file holds.
  2. Read Outpost's five verdicts (strength, weakness, noise, cannot tell, info) and the corrections behind them: Benjamini–Hochberg q < 0.10 for lines, Bonferroni |z| ≥ 2.73 / 2.77 for peers.
  3. Explain why games, not moves, are the unit (cluster-robust z), and why a peer pool's make-up can create a gap (the 78%-White pool).
  4. Replicate before believing: a second pool, split halves, White/Black, a null comparison.
  5. Locate a loss by phase and move number instead of blaming the opening name.
  6. Size a retest on new games, and connect the six themes and four anchors to what the data showed.

Timing plan

75-minute session

Minutes Activity Notes
0–8 Hook: Dev's expectation and the one-line verdict Show [noise] W: Najdorf 6.Be3: 36.0% [24.1-49.9] ... q = 0.254. Vote: "Drop the Najdorf?"
8–20 40.3 repertoire The 🧩 prediction; the 13-line table; q = 0.065 vs 0.040.
20–35 40.4 peers 17 comparisons, 15 noise. Clustered vs Poisson z. The 78%-White pool story.
35–45 40.5 game 401 Board demo below.
45–55 40.6 replication The Case Study 1 table: what survives?
55–68 40.7 GothamChess Clock: 14.7% won on time vs 5.6% lost. 9...Qa5+. Trompowsky vs Indian Game split-half.
68–75 Ladder and exit ticket 7.05 → 6.43: the next rung in numbers.

3-hour block

Minutes Activity Notes
0–15 Hook Students write their own --expect sentence first (the 🪞 check-in).
15–35 40.1–40.2 Module layers; live pytest (Data demo below).
35–70 40.3–40.5 Live repertoire and analyze on runs/dev; game 401.
70–90 40.6 + Case Study 1 Groups read the replication table.
90–100 Break
100–130 40.7 + Case Study 2 GothamChess pipeline and the five-moment game.
130–155 40.8 themes and anchors The discussion guide questions.
155–175 40.9 protocol Each student drafts a week-0 plan and a retest size.
175–180 Exit ticket

Key numbers and games

Item Value as quoted Where
Inventory 41 modules, 628 public functions/classes, 15,327 lines §40.1
Tests 65 passed, 1 warning in 17.57s (19 s wall), exit code 0 §40.2
Skewed peer pool 1,177 White / 323 Black (78%); balanced: 762 White of 1,500. Dev's win % after move 10: 1.71 worse (z = 1.24) → 0.45 better (z = −0.36) §40.2
Verdict bars BH q < 0.10 (lines); |z| ≥ 2.73 (8 indicators), ≥ 2.77 (9 error rates) §40.2
Dev's import 600 blitz games, 51.9% vs 49.9% expected; 569 with moves; 241 with stored evals (240 used) §40.3
Najdorf tabiya +0.32 (d18) / +0.40 (d24) Hook
Repertoire Italian 67.5% [56.6–76.8], n = 80, +15.4, q = 0.065 (0.040 in progress, which tests 8 lines); Najdorf 36.0% [24.1–49.9], n = 50, −12.2, q = 0.254; Scandinavian (Black) 30.0% [13.0–55.2], n = 15, −23.2, q = 0.254 §40.3
Scout 1.e4 in 100% of White games (0.04 bits); Black ≈ 2.5 bits §40.3
Analyze Book accuracy 87.1 (90.2 / 84.2 / 90.9); 7.30 blunders per 100 moves [6.72–7.92]; 70% of blunder win-% lost in the middlegame; "other" 55% of blunders §40.4
Peer gaps "Other" 4.01 vs 3.27, z 3.65 Poisson / 3.15 clustered (weakness); endgame conversion 0.10 vs 0.29, −3.10 / −4.14; opening accuracy 90.16 vs 90.12; lost on time 9.58% vs 10.80% §40.4
Game 401 +0.07 after move 10 (d18); 15.Bxh6 −0.55 → −2.71 (15.Bh4; −0.44 at d22); 19.gxf3 −1.03 → −6.34 (19.Nf5 −0.93 d20) §40.5; Exercise B1
Najdorf first mistakes 7 of 9 evaluated games; moves 7, 10, 11, 15, 15, 15, 18: median 15 §40.5; Case Study 1
Replication ("other") Pool B 2.85; odd/even 2.11 / 2.07 (4.04 / 3.97 per 100); White 2.92 vs Black 1.32; null row −1.06 / −0.58 / +1.30 §40.6; Case Study 1
GothamChess import 31,719 games, Mar 2017 – Nov 2026; blitz 18,294 §40.7
Clock Blitz: won on time 14.7%, lost 5.6% (2,690 vs 1,024) §40.7
Progress Climb +3.8/month [+3.4, +4.2], 2466 → 2881; last 12 months −3.0 [−8.0, +6.7]; tilt −0.9 [−2.5, +0.6], 2,581 sessions → cannot tell §40.7
Engine sample (SF19 d12, 60 games) 4.06 blunders per 100; failed to punish 31% of blunders; low clock 9.2 vs 3.7 per 100; 153 of 2,415 moves, 14 of 98 blunders §40.7
One game 9...Qa5+ −6.56 (d18) / −6.46 (d22); 9...e6 played in one second with 2:50 left §40.7; Case Study 2
Openings 73 lines tested; Trompowsky 1,448 games, +6.6 (strength; halves +6.2 / +6.7); Indian Game (Black) 278 games, −8.5, q = 0.031 (halves −9.5 / −6.0, verdict lost); split-half r = 0.42 over 36 lines §40.7
Ladder (Lichess blitz) 10.11 (< 1000) → 7.05 (1600–1799) → 6.43 (1800–1999) → 4.34 (2400+); steps −0.54 to −0.75; OTB 5.56 → 1.07 §40.8
Anchors A: Carlsbad +0.29 (d18). B: 10.Nxf7! line +6.18 (d18). D: +1.86 before 24.Nxh7 (d24), −0.50 after (d18; −0.28 at d24 in Chapter 24). Advance French +0.24 (d18), 3...c5 §40.8
Lena 203 rapid games; endgame accuracy 91.43 vs 92.10 (z 0.58); conversion 84.21% of 38 vs 89.02% (z 0.76); none of 17 survives Project Checkpoint
Retest arithmetic ±20 at 100 games, ±11.5 at 300, ±6.3 at 1,000; 66 + 66 games for halving a rate, about 309 for a 25% cut §40.9

Threshold concepts and likely misconceptions

Threshold concept: a finding is the start of an investigation. A significant number becomes a hypothesis, which then needs replication, a selection check and a retest. Students who have crossed this threshold say "the data points at…" rather than "my weakness is…".

Misconceptions to expect:

  • "65 green tests mean the analysis is right." The 78%-White pool passed every test. Tests check code, not design.
  • "My worst line is my weakness." With thirteen lines, about one bar misses zero by chance. The q-value corrects for the search.
  • "Noise means I'm fine." It means "we can't see it with this many games".
  • "q is a property of the line." The Italian is 0.065 in one table and 0.040 in another, with the same games and a different number of questions asked.
  • "The data found Dev's real weakness: calculation." It found a hypothesis, partly confounded by how the White games were selected by opening.
  • "Levy's 4.06 vs the Lichess 2400+ rung's 4.34 shows…" It shows nothing. Different pools, engines and selection.
  • "A Najdorf loss is an opening problem." Game 401 was +0.07 after move 10 and was lost at moves 15 and 19.
  • "The ladder proves fewer blunders raise your rating." The ladder is a cross-section, not a film.

How the four tracks use this chapter

  • ♟️ Improver: 40.1 for the map, then 40.3–40.7 as a story and 40.9 as the protocol. Exercises A1, A8, B1–B7, D1, D3, M2, M4.
  • 📊 Analyst: 40.4 (clustering, colour-balanced pools) and 40.6, with Case Study 1. Exercises A6, A7, A9, C2, C3, M1, M3, M5, E1.
  • 🏆 Competitor: scout on yourself (40.3) is the report an opponent builds on you. 40.7 shows how a strong player's weaknesses look in data. Exercises B6, D2, D3, E2.
  • 💻 Developer: 40.2 and the Project Checkpoint (cli.py, report.py, __main__.py, tests/). Exercises C1, C4–C7, E3.

Running the code

Install. Python 3.11+ and the book's stack:

pip install python-chess pandas numpy scipy matplotlib seaborn scikit-learn requests pyarrow pytest

Outpost uses the book's toolkit and the cached Stockfish 19 results. Run every command from project/:

python -m outpost import     --persona dev --work runs/dev --expect "My Najdorf (6.Be3) is my weak spot"
python -m outpost import     --chesscom GothamChess --work runs/gotham
python -m outpost import     --pgn my_games.pgn --player MyName --work runs/me
python -m outpost analyze    --work runs/dev
python -m outpost review     --work runs/dev --game 401 --depth 18
python -m outpost repertoire --work runs/dev
python -m outpost scout      --work runs/dev
python -m outpost progress   --work runs/gotham
python -m outpost report     --work runs/dev
python -m pytest -q tests

Defaults worth knowing: analyze --depth 12 --max-games 60 --workers 3 --peers auto --n-peers 1500; review --depth 14 (the chapter passes --depth 18 for game 401); import is cache-only unless --online is given (needed for --lichess downloads). python -m outpost <command> --help lists every option.

Not bugs: analyze prints PEERS: none for a Chess.com account, and progress refuses a trend, tilt or sessions for a composite, giving the reason.

The test suite: 65 tests. test_modules.py runs one parametrised import-and-docstring test over all 41 modules plus nine further tests: the module-to-chapter map and known-answer checks such as the Carlsbad skeleton, calc.mate_search, perft(3) = 8,902, Glickman's 1464.05 / RD 151.52, the KPK table and the rule of the square. test_cli.py has 15 tests that run every command on small cached samples (120 Dev games, a 4-game PGN, 400 GothamChess games) at shallow depth. With a warm cache the run takes under twenty seconds. The README promises "well under five minutes" in general. The one warning is a pandas deprecation notice. Exercise C6 adds a 66th test.

Chapter scripts (from the chapter folder, in this order): 01_toolkit_inventory.py (inventory, module map and pytest), 02_dev_pipeline.py, 03_public_pipeline.py (the GothamChess engine sample takes about 35 seconds with three workers), 04_ladder.py, 05_exercise_positions.py and 06_anchor_boards.py (run after 02 and 03), case_study_01.py (about forty seconds), case_study_02.py, project_checkpoint.py. Workspaces land in code/runs/{dev,gotham,lena}. Note that project_checkpoint.py's docstring says analyze runs without a peer pool, but the script passes --peers rapid:1300-1500, which is the run the chapter prints.

In-class demos

Board demo

Set up Dev's game 401 before move 15: r4rk1/1pqnbpp1/p2pbn1p/4p1B1/4P3/2N2N2/PPPQ1PPP/2R1RBK1 w - - 0 15. Ask: "Black has just played ...h6. Is 15.Bxh6 a sacrifice?" Have pairs list Chapter 11's preconditions and check each one: a follow-up with tempo, attackers that can arrive, a weakened shelter, something loose to win back. None is met. Reveal 15.Bh4 (−0.55 d18 / −0.44 d22) against 15.Bxh6 (−2.71), and the review's label: "hung material". Then show Anchor B (rnbqk2r/1p3ppp/p3p3/2b1N3/4pB2/4P3/PPPN1PPP/R2QK2R w KQkq - 0 10), where every precondition is met and 10.Nxf7! Kxf7 11.Qh5+ Kg8 12.Qxc5 is +6.18. Exercise M2 turns this into "four of four vs none of four".

Data demo

Run python -m pytest -q tests from project/ live: 65 passes in under twenty seconds. Ask "So the analysis is right?", then show the 78%-White pool and the gap it created (1.71 worse → 0.45 better). Follow with a live repertoire on runs/dev, after students have written down which of the thirteen lines will be called a weakness. Most pick the Najdorf, and none is called one.

Exercise guidance

  • Part A: everyone. A7 (why passing tests prove nothing about fairness) and A9 (q = 0.065 vs 0.040) are the core checks.
  • Part B: every position comes from a reviewed game. Grade the noticing sentence as well as the move.
  • B1: students recapture 19.gxf3 automatically. Ask "what is Black's next move?" (...Bg5 hitting h6 and c1). 19.Nf5 holds at −0.93.
  • B2/B3: the same loose a3-knight missed by both sides on consecutive moves (21.Nxe7! +4.67; 21...Bxa3! −3.51).
  • B4: the pinned c2-pawn. 30.Rb2! (0.00) against 30.Bxa5 (−10.24).
  • B5, B7: a queen that can simply be taken. B6: GothamChess's 9...Qa5+ (−6.54, depth 20).
  • Part C: C2 (depth table) and C3 (three more pools) show how much z moves when only the comparison changes. C5 must compare each player with himself. In C6, expect 66 passed.
  • Part D: D1 (is "no finding" worse than three weaknesses?) and D3 (24.Nxh7: unsound yet winning) make strong short essays. In D3 the chapter gives −0.50 at depth 18 and Chapter 24 gives −0.28 at depth 24. Both are correct, and students should quote the depth.
  • Part M: M1 (roughly 36–40 games by the normal approximation, a few more with Wilson, for the upper end to fall below 51.9%, and more again once thirteen lines are corrected for), M3 (about 8,850 games for a ±1-point tilt interval) and M5 (Spearman–Brown ≈ 0.59) for Analysts.
  • Part E: E1 (an opening-matched peer pool) is the natural follow-up to Case Study 1's confound. E2 is the capstone for students using their own games.

Assessment ideas: grading the capstone

The capstone deliverable (see Assessments) is a python -m outpost pipeline run end to end on a real game set, an HTML report, passing smoke tests and a 1,500–2,500-word write-up that answers does the data find the weakness the player expected? Grade it with the capstone rubric, section 4: six criteria, 16 × 4 = 64 points. Here is how the chapter maps onto each criterion:

  1. Integration (×3). The seven commands run in order on one workspace, and pytest passes (65, or 66 with C6). Exemplary work handles the refusals correctly: no peer pool off-scale, no trend for a composite.
  2. The question (×2). The --expect sentence and a decision rule are written before the run, as in the 🪞 check-in ("if my win % after move 10 is within two points of my peers', the opening is not my problem"). A prior written after seeing the report scores Developing.
  3. Analysis quality (×4). Uses the verdict vocabulary honestly, reports intervals and q/z values, and runs at least one replication from Case Study 1 (second pool, split halves or a null comparison). It checks two depths on critical positions and names any selection confound. Red flags: calling noise a weakness, cross-pool comparisons, retesting on the same games.
  4. Chess insight (×3). Turns at least one finding into positions, the way 40.5 does with game 401 (where the evaluation stood, which move, what habit would have caught it).
  5. Report (×2). The HTML page starts with expectation vs evidence, and charts are described.
  6. Honesty and ethics (×2). Composites are labelled, no amateur usernames appear, there are no fair-play insinuations, and "cannot tell" is said plainly.

Give full marks to an honest null result: Lena's run (none of seventeen comparisons survives) is a model answer. Presentation, 8 minutes: one live command, one unexpected finding, one limitation.

Shorter assessments: the chapter quiz (20 questions, scored out of 25: Q17–19 two points each, Q20 three) fits a 30-minute slot. A good short answer: "Explain, with Dev's numbers, why the toolkit called the Najdorf noise and the Italian a strength."