Chapter 40 Exercises — Your Complete Toolkit

Difficulty: ⭐ recall · ⭐⭐ apply · ⭐⭐⭐ analyse and judge · ⭐⭐⭐⭐ open-ended project. Commands are run from the book's project/ folder; chapter scripts from the chapter folder. Every position in Part B comes from a game the toolkit reviewed in this chapter and was verified with Stockfish 19 (depth 20, two principal variations) by code/05_exercise_positions.py.


Part A — Concepts ⭐

A1. Name the seven python -m outpost commands and, in one line each, the question each answers.

Answer

import — which games, from which source and rating pool? analyze — how accurate am I, how often and how do I blunder, and (for Lichess-pool players) how does that compare with peers? review — where did this one game turn and what kind of error was it? repertoire — which openings do I score better or worse in than my own average, and what is my tree? scout — what could an opponent learn about me from my games? progress — am I improving, on a plateau, tilting, and how do my speeds compare inside their own pools? report — all of it on one page, starting with my expectation beside the evidence.

A2. What is a workspace, and why does the toolkit write every intermediate result into it?

Answer

A folder holding the games table (games.parquet), meta.json and each command's outputs. Writing everything down lets you run the expensive engine step once and the cheap steps often, inspect any intermediate file by hand, and find which step produced a strange number. It also makes every report reproducible.

A3. List Outpost's five verdicts and the rule behind each.

Answer

Strength / weakness: the gap survives a multiple-testing-corrected test (BH q < 0.10 for opening lines vs your own average; Bonferroni |z| ≥ 2.73 / 2.77 for the peer indicators / error rates). Noise: measured but does not survive. Cannot tell: an interval includes "no difference" (trends, tilt). Info: a description with no comparison.

A4. Why does meta.json record the rating pool? Give an example of a comparison the toolkit refuses to make because of it.

Answer

Because Chess.com, Lichess and FIDE ratings are different scales (Chapter 30). The toolkit refuses to compare a Chess.com account's blunder rate with the book's Lichess peer pool, and progress compares each time class with its own Elo expectation instead of comparing ratings across time classes.

A5. What does progress print for a composite player, and why is that the right output?

Answer

"No trend" (with the reason) and no tilt or session analysis. A composite is assembled from many anonymous players over about thirty-four hours: it has no history to trend and no sessions of one person to study. Refusing to compute an indefensible number is better than computing a meaningless one.

A6. The chapter found two problems while assembling the pipeline. Name them and the fix for each.

Answer

(1) Chapter 25's peer pool was 78% White because it kept White whenever both players were in the band; fix: an optional both="random" argument (a seeded coin flip), used by Outpost, with the old default kept so Chapter 25's numbers still reproduce. (2) Chapter 38's comparison treated each move as an independent Poisson trial; fix: a cluster-robust z with games as the unit and the peer pool's own noise included (cli.clustered_z), which drives the verdict.

A7. Why is "65 tests passed" not evidence that a comparison in the report is fair?

Answer

Tests check that code runs and that known answers come out right. A biased comparison group — like the 78%-White peer pool — runs perfectly and produces plausible numbers. Fairness is a design property, checked by stating and inspecting the comparison group and by replication, not by unit tests.

A8. In one sentence each, what did the data say about the weakness Dev expected and the one Dev guessed for GothamChess?

Answer

Dev's Najdorf 6.Be3 (36.0% [24.1–49.9] over 50 games) is noise (q = 0.254) and his opening play is level with his peers'; GothamChess wins on time far more often than he loses on time (14.7% vs 5.6% of blitz games), so the clock is a net asset, not the leak.

A9. Explain in your own words why Dev's Italian Game has q = 0.065 in the repertoire table but q = 0.040 in the progress recommendations, when the games are the same.

Answer

The q-value corrects for how many lines were tested together. repertoire tested thirteen lines (all with at least ten games); the recommendations tested only the eight lines with at least twenty games. Fewer simultaneous questions mean a smaller correction, so the same evidence earns a smaller q. The lesson: a q-value describes the evidence and the search that produced it — always report how many things you looked at.


Part B — Positions ⭐⭐

Each position is from a game reviewed in this chapter. Find the best move and say what you would have to notice to find it at the board.

B1. Find the move (Dev's game 401). Dev, White, has just seen Black capture on f3 with the bishop.

Exercise B1: White to move

♟️ Position: White Kg1, Qh6, Rc1, Re1, Bf1, Ng3, a2, b2, c2, f2, g2, h2, e4; Black Kg8, Qc7, Ra8, Rf8, Bf3, Be7, Nd7, Nh7, e5, a6, d6, b7, f7 — White to move. FEN: r4rk1/1pqnbp1n/p2p3Q/4p3/4P3/5bN1/PPP2PPP/2R1RBK1 w - - 0 19

Solution

19.Nf5! (Stockfish 19, depth 20: −0.93; the second-best move, 19.Qh3, is −4.83). Dev played 19.gxf3, which the depth-18 review rates −6.34: after 19...Bg5 the bishop hits the queen on h6 and, along the same diagonal, the rook on c1 — the queen steps away and the rook falls (19...Bg5 20.Qh3 Bxc1). 19.Nf5 does two things at once: it puts a knight on the hole in front of Black's king (eyeing e7, g7 and h6) and it keeps the queen's retreat open, so Black has no time to take on g2 or set up ...Bg5. What to notice: before recapturing "automatically", ask what the opponent's next move is — here ...Bg5, hitting the queen and the rook behind it.

B2. Find the move (Dev's game 600). White to move; the e7-bishop eyes the knight on a3.

Exercise B2: White to move

♟️ Position: White Kc1, Qg2, Rd1, Rh1, Bf1, Bd2, Na3, Ng6, b2, c2, d3, f4, g4, e5, h5; Black Ke8, Qc7, Ra8, Rg8, Bb7, Be7, Nd4, Nh7, c4, d5, f5, a6, e6, h6, g7 — White to move. FEN: r3k1r1/1bq1b1pn/p3p1Np/3pPp1P/2pn1PP1/N2P4/1PPB2Q1/2KR1B1R w q - 0 21

Solution

21.Nxe7! (depth 20: +4.67; the second choice, 21.dxc4, is +1.15). Dev played 21.gxf5, after which 21...Bxa3 (depth 18 line: 21...Bxa3 22.dxc4 dxc4 23.Qh3 Bxb2+ 24.Kxb2) leaves him at −3.13. The point of Nxe7 is order: take the piece that attacks your loose knight first, with tempo (the queen must recapture), and only then collect the f5-pawn. The game's move was the right idea in the wrong order — the most common way a winning position becomes a losing one.

B3. Find the opponent's move (Dev's game 600). Black to move, one ply later, after 21.gxf5.

Exercise B3: Black to move

♟️ Position: White Kc1, Qg2, Rd1, Rh1, Bf1, Bd2, Na3, Ng6, b2, c2, d3, f4, e5, f5, h5; Black Ke8, Qc7, Ra8, Rg8, Bb7, Be7, Nd4, Nh7, c4, d5, a6, e6, h6, g7 — Black to move. FEN: r3k1r1/1bq1b1pn/p3p1Np/3pPP1P/2pn1P2/N2P4/1PPB2Q1/2KR1B1R b q - 0 21

Solution

21...Bxa3! (depth 20: −3.51; the second choice 21...Nb3+ is +1.92). The bishop removes the knight and opens b2 to a later ...Bxb2+ (depth 20 line: 21...Bxa3 22.dxc4 dxc4 23.Qh3 Bxb2+ 24.Kxb2). Dev's opponent played 21...Nxf5 (+4.39 at depth 18), and White could have taken on e7 after all (22.Nxe7). Both sides missed the same loose piece on consecutive moves — a "failed to punish" pair of the kind that makes up about a quarter of Dev's blunders.

B4. Defend (Dev's game 600). White to move. Black's queen and rook stare down the c-file at White's king.

Exercise B4: White to move

♟️ Position: White Kc1, Qh2, Rd1, Rb3, Bd2, Ng6, c2, a3, f4, e5, h5; Black Ke8, Qc4, Rc8, Rg8, Nf5, Nh7, d4, a5, e6, h6, g7 — White to move. FEN: 2r1k1r1/6pn/4p1Np/p3Pn1P/2qp1P2/PR6/2PB3Q/2KR4 w - - 0 30

Solution

30.Rb2! (depth 20: 0.00; the second choice, 30.Bc3, is −5.39). Dev took a pawn with 30.Bxa5, rated −10.24 at depth 18: 30...Qxb3! and the rook cannot be recaptured because the c2-pawn is pinned by the c8-rook to the king on c1. The quiet 30.Rb2 takes the rook off the square where the pin makes it undefended. What to notice: a pawn "defending" a piece is no defence if moving it would expose your king — check every defender for pins before you count.

B5. Find the move (Dev's game 600). White to move, eleven moves later. Black has just played 40...Qd1.

Exercise B5: White to move

♟️ Position: White Ke3, Rd3, Bb4, Nf3, a3, f4, e5, h5; Black Ke8, Qd1, Rc8, Nh7, e6, h6, g7 — White to move. FEN: 2r1k3/6pn/4p2p/4P2P/1B3P2/P2RKN2/8/3q4 w - - 5 41

Solution

41.Rxd1 (depth 20: +7.78) — the queen is simply hanging to the rook. Dev played 41.Nd4 (−7.96 at depth 18 after 41...Qg1+), and the game was lost. Nothing in this position is hard; it is a one-move capture missed in a blitz game, the purest form of "failed to punish". The lesson is the habit, not the chess: after every opponent move, ask what did that move leave unprotected?

B6. Find the tactic (GothamChess's game). Black to move; White has just played 9.Bb5.

Exercise B6: Black to move

♟️ Position: White Ke1, Qd1, Ra1, Rh1, Bc1, Bb5, Ne5, a2, b2, c2, f2, g2, h2, d4; Black Ke8, Qc7, Ra8, Rh8, Bc8, Bf8, Nd7, d5, a7, b7, e7, f7, g7, h7 — Black to move. FEN: r1b1kb1r/ppqnpppp/8/1B1pN3/3P4/8/PPP2PPP/R1BQK2R b KQkq - 1 9

Solution

9...Qa5+! (depth 20: −6.54; the second choice, 9...a6, is +0.30). The check forks the king and the b5-bishop; after 10.c3 (or 10.Bd2) 10...Qxb5 Black is a piece up. Levy played 9...e6 in one second with 2:50 on his clock. The checks-captures-threats scan of Chapter 10 finds 9...Qa5+ immediately: a check that also attacks an undefended piece is the first candidate to look at.

B7. Find the move (Dev's game 600). White to move; Black's queen has come to c4.

Exercise B7: White to move

♟️ Position: White Kd2, Rd4, Bb4, Nf3, a3, f4, e5, h5; Black Ke8, Qc4, Rc8, Nh7, e6, h6, g7 — White to move. FEN: 2r1k3/6pn/4p2p/4P2P/1BqR1P2/P4N2/3K4/8 w - - 1 39

Solution

39.Rxc4 (depth 20: −0.55) — the rook takes the queen. Count it: White gives a rook (5) for the queen (9); after 39...Rxc4 White's bishop and knight face Black's rook and knight, and the depth-20 line 39.Rxc4 Rxc4 40.Ke3 Kf7 41.Nd4 Rc8 is roughly level. Dev played 39.Ke3, rated −7.83 (the second choice at depth 20 is the same −7.66): the queen stays, and with it Black's attack. When the opponent's queen can be taken by a rook, take it unless you can see why not.


Part C — Data & Code ⭐⭐–⭐⭐⭐

C1. Import your own games. ⭐⭐ Export at least 200 of your games at one speed as PGN and run python -m outpost import --pgn your.pgn --player YourName --work runs/me --expect "...". Then run analyze, repertoire and report. Expected output: a workspace with games.parquet (one row per game, your side), an analyze.txt with your book accuracy by phase and blunder types, and report.html. If your games have no evaluations, analyze runs Stockfish on the most recent 60: note the run time it reports.

C2. Depth and the verdicts. ⭐⭐⭐ Run analyze --engine always on Dev's workspace at depths 10, 12 and 16 (use --max-games 40). Build a table: book accuracy, blunders per 100 moves, and the share of each blunder type, by depth. Expected shape: one row per depth, nine columns. Which numbers move most with depth? (Hint: Chapter 32 found the labels agree with depth 18 in 86.7% of moves at depth 12 and 91.6% at depth 16.)

C3. A second peer pool. ⭐⭐ Modify code/case_study_01.py to draw three more peer pools (seeds 2028–2030) and report the clustered z of Dev's "other" gap against each. Expected output: five rows (seeds 2026–2030), student, reference, z_clustered. How much does z move from pool to pool, with Dev's games fixed?

C4. Repertoire with a database reference. ⭐⭐⭐ run_repertoire judges lines against Dev's own average. Extend it with an optional database comparison: for each line, the score of White (or Black) in the Lichess sample at Dev's speed and band (chessdata.lichess_games(speed="blitz", min_elo=1550, max_elo=1750, balanced=True), opening family = the part of the Lichess opening name before the first colon). Expected output: the existing table plus db_score, db_n. Check your Italian row against the book's database figure (51.6% for White at Dev's band).

C5. The clock, three ways. ⭐⭐ For the GothamChess workspace, compute (a) the share of blitz games won and lost on time, (b) the blunder rate with own clock below 10% of base vs above, and (c) the score minus expectation by time control, as code/03_public_pipeline.py does. Then do the same for Hikaru (import --chesscom Hikaru). Expected output: a 2 × 3 table. Remember to compare each player with himself — the two accounts share a Chess.com pool, but not a level.

C6. A test for your change. ⭐⭐ Add a test to project/tests/test_cli.py that checks the peer pool drawn with both="random" has between 45% and 55% White players for blitz:1550-1750 with n=400. Run the suite. Expected: 66 passed.

C7. Report sections. ⭐⭐⭐ Add a section to report.py that lists, for the player's three most frequent blunder types, the training block Chapter 38's coach.BLOCKS assigns to each. Keep it descriptive: the section must not say "weakness" unless the verdict file does.


Part D — Judgment & Transfer ⭐⭐⭐

D1. A 1200-rated club player runs the toolkit and gets "no finding survives the statistics". A 2000-rated player gets three weaknesses. Is the stronger player worse off? What do the two reports mean for each?

Discussion

Not necessarily. Verdicts depend on sample size and on how far a player is from their peers. Many club players are "typical for their rung": the honest report is then the general plan for that rung (at 1200 the ladder says hung pieces and failures to punish dominate — Chapter 38). A stronger player with more games and more specific habits is more likely to show surviving gaps. "No finding" is information too: it tells the 1200 not to chase a specific weakness but to reduce the common blunders of the rung.

D2. Dev's "other" gap is stronger in his White games (z = 2.92) than in his Black games (1.32). Give two explanations and say what data would separate them.

Discussion

(1) Selection: his White games were chosen by opening (a 1.e4 repertoire with many Italian and Najdorf games), which may produce more quiet, plan-heavy middlegames than his random Black games. (2) A real colour effect: he may handle the initiative worse than the defence. To separate them, compare his White games with peers' White games in the same openings (an opening-matched pool), and gather more Black games.

D3. The engine says 24.Nxh7 in Anchor D's round-3 game was unsound (−0.50 at depth 18), yet it won. Should a review classify it as a mistake? What would you tell a student who played it?

Discussion

By the book's definition it was a real error: Chapter 24 measured +1.86 before it (depth 24, with 24.Rd7 best) and −0.28 after it — White gave away a clear advantage for an unsound attack. It still won because Black then erred under pressure (24...Rh8? was +2.73). The useful conversation is about practical chances: one narrow defence, an opponent under pressure, and a clear plan. Praise the reasoning, make sure the student knows it was objectively dubious, and ask what they would do against an opponent who finds 24...Kxh7.

D4. At 1200 the largest blunder type is "left a piece en prise" (Chapter 38: about a quarter of blunders below 1000); at 2000 it is "other". What does that mean for how the toolkit's advice should change with level?

Discussion

At lower levels the highest-value habit is a blunder check (is every piece safe? what did the last move attack?) and the opening phase matters more; at higher levels most blunders are quiet misjudgements that need calculation and prophylaxis training. The toolkit's curriculum module already starts from the band's error mix; a coach should start from the same place and only then adjust for the individual.

D5. A friend shows you a Chess.com report with "Accuracy 91" for a game and asks why Outpost's review says the book accuracy for the same game is 86. Who is right?

Discussion

Both, by their own definitions. Chess.com's figure (CAPS) is proprietary; Lichess's displayed figure mixes volatility-weighted and harmonic means; the book's accuracy is the plain arithmetic mean of per-move accuracies from the Lichess win-% model, with Stockfish 19 at a stated depth. The numbers are not comparable across definitions. What matters is comparing like with like: your games with your games, or with peers measured the same way — which is why Outpost's report labels the Chess.com number on its dashboard as "platform accuracy, not book accuracy".


Part M — Mixed / Interleaved ⭐⭐–⭐⭐⭐

M1. (Chapters 20 and 40) ⭐⭐ With the Wilson interval from Chapter 20, how many Najdorf games would Dev need at a 36% score for the interval's upper end to fall below his overall average of 51.9%?

Answer

Solve 0.36 + 1.96·√(0.36·0.64/n) < 0.519: √(0.2304/n) < 0.0811 → n > 35. Roughly 36–40 games by the normal approximation (the Wilson interval is slightly wider, so a few more). But that is one interval; with thirteen lines tested the false-discovery correction asks for more, which is why 50 games at 36% was still "noise".

M2. (Chapters 4, 11 and 40) ⭐⭐ Compare Dev's 15.Bxh6 (game 401) with Anchor B's 10.Nxf7. Using Chapter 4's attacker-count idea and Chapter 11's preconditions, list which preconditions each position met.

Answer

Anchor B: the defending king was uncastled in the centre, the defender's queenside was undeveloped, a follow-up queen check (Qh5+) existed and won back material (the loose c5-bishop). Game 401: Black was castled with an intact shelter, all Black's pieces were developed, no White piece could join the attack with tempo, and nothing loose could be won back. Four of four vs none of four.

M3. (Chapters 28, 35 and 40) ⭐⭐⭐ GothamChess's tilt interval is [−2.5, +0.6] over 2,581 sessions. Using Chapter 28's per-game residual standard deviation (about 48 points), roughly how many games after a loss would be needed for a ±1-point interval — and is that a sensible goal?

Answer

±1.96·48/√n = 1 → n ≈ 8,850 games after a loss, and as many after a win. He has played enough blitz to approach that, but for almost anyone else it is out of reach, and the population effect (about −2 points) is small anyway. The sensible goal is a behaviour rule (a pause after a loss, a stop after two in a row) rather than a precise personal estimate.

M4. (Chapters 10 and 40) ⭐⭐ In Exercise B6, 9...Qa5+ was found by the checks-captures-threats scan. Apply the same scan to Exercise B5 and count the candidate moves before you reach the solution.

Answer

Checks first (none that do anything useful for White in B5), then captures: 41.Rxd1 is the first capture to look at — the scan reaches the solution almost immediately. The lesson of both exercises is the same: the scan is cheap and it works; the errors came from skipping it.

M5. (Chapters 31 and 40) ⭐⭐⭐ In the GothamChess split-half, 36 lines had at least 30 games in both halves and the halves correlated at r = 0.42. What does that tell you about how much of a line's "vs own average" figure is signal?

Answer

Roughly, the split-half correlation estimates the reliability of a half-sample measure: under half of the variation between lines in one half is repeated in the other. With the full history (twice the games), reliability is higher (by the Spearman–Brown formula about 2·0.42/1.42 ≈ 0.59), but still far from 1 — individual line figures should be shrunk towards the player's average before being acted on, as Chapter 20's shrink does.


Part E — Research & Extension ⭐⭐⭐⭐

E1. An opening-matched peer pool. Build a version of analyze --peers that matches the peer games to the player's opening mix (for each of the player's opening families, sample peer games from the same family in the same proportion). Re-run Dev's comparison. Does the "other" gap survive once the 1.e4-selection is removed? Write up the method, the result, and what it means for the persona-building rule.

E2. A season with Outpost. Run the twelve-week protocol (40.9) on your own games. Pre-register your target metric and the retest size before week 1; at week 12 report the before/after numbers with intervals, whether the change exceeds what Chapter 28's per-game noise predicts, and what you would do differently.

E3. A coach's dashboard. Extend report.py to build one page for a group of players (a club or a class): one row per player with their surviving findings, the group's shared blunder-type mix, and a curriculum from coach.curriculum for the group. Discuss which statistical corrections change when you look at twenty players at once.