Exercises — Chapter 14: Essential Endgames

Difficulty: ⭐ recall · ⭐⭐ apply · ⭐⭐⭐ analyse/judge · ⭐⭐⭐⭐ open-ended project. Every position below is either a tablebase-verified construction or a position from a real game; the solutions come from the Syzygy tablebase (through outpost.tablebase) or the chapter's K+P vs K solver, and the script that checks them is code/07_exercise_positions.py (output in code/07_output.txt).


Part A — Concepts ⭐

A1. State the book's definition of an endgame and of a pure endgame. Using it, what share of OTB classical games in our data reach an endgame, and what share of Lichess blitz games?

Solution

Endgame: combined non-pawn material of both sides (N/B 3, R 5, Q 9) ≤ 26; pure endgame: an endgame with no queens. OTB classical 63.0% (n = 236,556); Lichess blitz 51.5% (n = 394,946, weighted). Across all speeds the pure (queenless) endgame is reached in 52.2% of OTB and 38.7% of Lichess games.

A2. Define WDL, DTZ and DTM. Which of them matters for the 50-move rule, and what is a "cursed win"?

Solution

WDL = win/draw/loss for the side to move; DTZ = plies to the next capture or pawn move (the "zeroing" move) along the best line; DTM = plies to mate. DTZ matters for the 50-move rule, because only a zeroing move resets the counter. A cursed win is a position that is won with unlimited moves but drawn because the win cannot be achieved within the 50-move limit.

A3. Explain the rule of the square and the special case of a pawn on its starting square.

Solution

Draw the square whose side runs from the pawn to its promotion square; if the defending king, with the defender to move, can step into it, it catches the pawn. A pawn on its second rank can advance two squares at once, so its square is drawn as if it were already on the third rank.

A4. What does "having the opposition" mean, and why is it the side not to move that has it?

Solution

The kings face each other on a line with an odd number of squares (usually one) between them. Since kings may not stand next to each other, the side to move must step aside and give ground; the other side — the one that made the last move into the face-to-face position — keeps its king where it is and "has" the opposition.

A5. Define key squares. Why does a rook pawn have none?

Solution

Squares from which the attacker's king wins against every placement of the defending king (that cannot simply capture the pawn). A rook pawn has none because a defending king that reaches the queening corner cannot be evicted — the attacker either stalemates it or abandons the pawn — so no single king square wins against every defence. Our solver found no key squares for a pawn on a4.

A6. In one sentence each, describe the winning plan of the Lucena position and the drawing plan of the Philidor position.

Solution

Lucena: cut the defending king off by one more file with a rook check, put the rook on the fourth rank, step the king out, and block the checks with the rook (the bridge). Philidor: keep the rook on your third rank while the pawn is on the fifth, then check from behind as soon as the pawn advances to the sixth.

A7. State Tarrasch's rule and give the tablebase verdicts for the chapter's "rook behind / rooks reversed" pair.

Solution

Rooks belong behind passed pawns — your own and your opponent's. Rook behind White's a-pawn (Black's rook in front): win. Rooks reversed (White's rook in front, Black's behind): draw. The same split held with a b-pawn.

A8. Which of these is drawn by rule (insufficient material), which is drawn only with correct defence, and which is a forced win: K+N vs K, K+N+N vs K, K+B+N vs K?

Solution

K+N vs K: drawn by rule. K+N+N vs K: a mate exists, so it is not a draw by rule, but it cannot be forced — a draw with correct defence. K+B+N vs K: a forced win (DTM 57 plies from the chapter's test position), but only in a corner of the bishop's colour.


Part B — Positions ⭐⭐

B1. Endgame technique — opposition.

Exercise B1

♟️ Position: White Kd5, d4; Black Kd7 — White to move. FEN: 8/3k4/8/3K4/3P4/8/8/8 w - - 0 1

What is the result with White to move? With Black to move? Name the key squares of the d4-pawn.

Solution

White to move: draw. Black to move: White wins. The key squares of a d4-pawn are c6, d6 and e6. With White to move, Black has the opposition: 1.Kc5 Kc7 or 1.Ke5 Ke7 and the white king never reaches a key square. The tablebase lists four White moves (Kc4, Ke4, Kc5, Ke5) and all four draw. With Black to move, Black must give way — 1...Kc7 2.Ke6 or 1...Ke7 2.Kc6 — and the solver finds the promotion 12 plies away; the tablebase agrees (1-0).

B2. Endgame technique — the square.

Exercise B2

♟️ Position: White Ka8, h2; Black Kb4 — White to move. FEN: K7/8/8/8/1k6/8/7P/8 w - - 0 1

White's king is far away. Who wins with White to move, and what changes with Black to move?

Solution

White to move: only 1.h4! wins (tablebase: h4 is the single winning move; 1.h3 and the king moves draw). After the double step the square of the pawn is d4–d8–h8–h4, and the black king on b4 cannot step into it: 1...Ka3 2.h5 and the pawn promotes (tablebase line h4 Ka3 h5 Ka2 h6 Kb1 h7 Kc1 h8=Q). With Black to move it is a draw: the pawn on h2 counts as if on h3, its square reaches c3, and 1...Kc4 (or Kc3, Kc5) steps inside. Note the trap in the first case: 1.h3? gives up the double step and draws.

B3. Endgame technique — Lucena with a d-pawn.

Exercise B3

♟️ Position: White Kd8, Re1, d7; Black Kf7, Rc2 — White to move. FEN: 3K4/3P1k2/8/8/8/8/2r5/4R3 w - - 0 1

Black's king is already cut off. Build the bridge.

Solution

1.Rf1+! first — the king on f7 still covers e7 and e8, so it must be driven one more file away. Then 2.Rf4! (the bridge) and the king walks out: 1.Rf1+ Kg7 2.Rf4 Rc1 3.Ke7 Re1+ 4.Kd6 Rd1+ 5.Ke6 Re1+ 6.Kd5 Rd1+ 7.Rd4 — every White move checked: still 1-0. The tablebase rates 11 of White's 14 first moves as wins (DTZ 15, DTM 37); 1.Rc1 and 1.Re6 draw, 1.Re2 loses the rook.

B4. Endgame technique — Philidor with a d-pawn.

Exercise B4

♟️ Position: White Kc5, Rg7, d5; Black Kd8, Rh6 — Black to move. FEN: 3k4/6R1/7r/2KP4/8/8/8/8 b - - 0 1

Find a drawing move and the plan that follows. Which natural-looking moves lose?

Solution

Draw. Eight Black moves hold: 1...Rf6 or 1...Ra6 (the third-rank defence), the immediate checks from behind 1...Rh1–Rh4 (the white king is not yet on the sixth), and the king moves 1...Kc8 and 1...Ke8. The plan after 1...Rf6: 2.d6 Rf1! 3.Kc6 Rc1+ 4.Kd5 Rd1+ — checks from behind, all draws in the tablebase check. Eight moves lose, among them 1...Rh8 (the passive back rank), 1...Rd6?? (the king simply takes it), 1...Rb6? and the check 1...Rc6+?.

B5. Analyze this position — bishop and rook pawn.

Exercise B5

♟️ Position: White Kb5, Bd2, a5; Black Kb7 — Black to move. FEN: 8/1k6/8/PK6/8/8/3B4/8 b - - 0 1

White is a bishop and a pawn up. Can Black draw? What is the key fact?

Solution

Yes — every Black king move draws (Ka7, Ka8, Kb8, Kc7, Kc8; tablebase: draw). a8 is a light square and White's bishop on d2 is dark-squared: the wrong rook pawn. Black's king only needs to reach the corner a8 (or the squares b7/b8 next to it) and White can never drive it out without stalemate.

B6. Analyze this position — queen against the f-pawn.

Exercise B6

♟️ Position: White Ka8, Qb6; Black Kg2, f2 — White to move. FEN: K7/8/1Q6/8/8/8/5pk1/8 w - - 0 1

White has a queen against a pawn. Win or draw?

Solution

Draw — every one of White's 25 moves draws, including the immediate 1.Qxf2+ (Kxf2 leaves king against king). The f-pawn is a bishop pawn: against checks Black's king goes to h1 when the queen attacks the pawn, and capturing the pawn would stalemate. With White's king on a8, far away, the queen alone cannot make progress — the same stalemate trick as against the c-pawn in section 14.7.

B7. Find the move — a real World Cup ending (⭐⭐⭐).

Exercise B7: Le Quang Liem - Donchenko, FIDE World Cup 2025, after 69...Ke2

♟️ Position: White Ke4, Rf6; Black Ke2, Rb3, h4 — White to move. FEN: 8/8/5R2/8/4K2p/1r6/4k3/8 w - - 6 70

Black has just played 69...Ke2, turning a won ending into a draw. White now has 19 legal moves. Find a move that holds the draw — and explain why the natural king moves fail.

Solution

Only 70.Ra6, 70.Rc6 and 70.Rd6 draw; the other 16 moves lose (tablebase, code/cs01_output.txt). The rook must stay on the sixth rank, from which it can swing to the h-file behind the pawn (Tarrasch's rule for the defender): the game went 70.Ra6 Rb4+ 71.Kf5 h3 72.Rh6 Rb3 73.Kg4 Kf2 74.Rxh3 Rxh3 75.Kxh3, draw. King moves lose because the white king cannot catch the pawn alone, and every tempo spent on the king lets Black's rook cut it off while the h-pawn runs. Case Study 1 analyses the whole ending.

B8. Endgame technique — a spoiled win from real play (⭐⭐).

Exercise B8: Lichess blitz, White to move

♟️ Position: White Kc4, a4; Black Ke5 — White to move. FEN: 8/8/8/4k3/P1K5/8/8/8 w - - 3 65

In a real Lichess blitz game (average rating 1136) White played 65.a5? here and only drew. Which moves win?

Solution

65.Kc5 or 65.Kb5 — the only two winning moves (solver: 1-0, promotion 11 plies away); Kb4, Kd3, Kc3, Kb3 and a5 all draw. White's king must shoulder the black king away from the a8 corner; once Black's king reaches the corner (65.a5? Kd6 66.Kb5 Kc7 67.a6 Kb8), the rook pawn cannot win. Case Study 2 explains how often this kind of error happens.

B9. Build the plan — Tarrasch's rule (⭐⭐).

Exercise B9: White's rook behind the a-pawn

♟️ Position: White Kg2, Ra1, h3, a5; Black Kg7, Ra8, h6 — White to move. FEN: r7/6k1/7p/P7/8/7P/6K1/R7 w - - 0 1

The tablebase says White wins. Describe White's plan in three steps, and say what changes if you swap the two rooks (White Ra8, Black Ra1).

Solution

(1) Advance the pawn with the rook's support from behind — 1.a6 is the tablebase's first choice — so Black's rook is tied to the a-file in front of it; (2) bring the white king towards the queenside while Black's king must keep watch over the kingside pawns (it cannot both guard h6 and stop the a-pawn); (3) use the moment Black's rook must leave the a-file, or Black's king abandons the kingside, to promote or to win the h6-pawn. With the rooks swapped, the tablebase verdict is a draw: White's rook is the passive one on a8, Black's rook attacks the pawn from behind and checks the white king whenever it approaches. Stockfish 19 agrees in direction: +5.33 vs 0.00 at depth 24.


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

C1. Database research (⭐⭐). Extend code/03_endgame_census.py to Lichess bullet and OTB rapid. Output: a table with one row per band (n ≥ 300) and the share of games reaching a book endgame. Expected shape: 8 rows × 2 pools. Does the online rating gradient (more endgames at higher ratings) also appear in bullet? (The reference numbers for comparison are in section 14.1's sources: Lichess bullet ranges from 39.8% below 1200 to 64.8% at 2400+.)

C2. Database research (⭐⭐). Using the endgame replay table, compute the share of endgame games that pass through a pawn ending by band (Lichess blitz and OTB classical). Expected output: a 2 × 8 table and a line chart. Is the 9.5% / 9.4% average stable across bands?

C3. Engine analysis (⭐⭐⭐). For the Tarrasch pair in section 14.6, run Stockfish 19 at depths 12, 16, 20, 24 and 28 and plot the evaluation of each position against depth. Expected output: two lines, one rising towards a winning score, one hovering near 0.00. At what depth does the gap exceed +3.00? What does that say about relying on shallow engine checks in rook endings?

C4. Engine analysis (⭐⭐⭐). Use tablebase.check_line on the K+P vs K or R+P vs R part of five of your own games (or five games from code/kpk_games.csv / code/rpr_sample.csv). Output: for each game, the list of moves flagged ERROR, the side that made them and the clock time left (from [%clk] where available). Do the errors cluster under time pressure?

C5. Database research (⭐⭐⭐). code/04_theory_vs_practice.py takes the first K+P vs K position of each game. Modify it to classify every K+P vs K position in the game, and count how many games change theoretical result more than once (win → draw → win). Expected output: the distribution of "result changes per game" by pool.

C6. Database research (⭐⭐⭐). Repeat the R+P vs R theory-vs-practice sample with 300 instead of 150 games per pool (seed 2026; pace the tablebase requests). Do the percentages in section 14.8 move by more than their sampling error? Report Wilson 95% intervals.

Notes on Part C
  • C1: load only the columns you need from game_features (columns=[...]), exclude bot games with chessdata.is_bot_game, and weight Lichess rows by sample_weight. The reference values for Lichess bullet run from 39.8% below 1200 to 64.8% at 2400+, so the online gradient is, if anything, steeper in bullet.
  • C2: the endgame replay table has a kp_ply column (first stable pawn ending); divide weighted counts with kp_ply present by weighted endgame games in each band. Report n per band and drop bands with n < 300.
  • C3: use engine.evaluate(fen, depth=d); results are cached, so rerunning is instant. Plot depth on the x-axis and centipawns on the y-axis; mark the tablebase verdict (win / draw) in the legend, not as a number.
  • C4–C5: tablebase.check_line needs the position before the first graded move and the list of SAN moves after it; for K+P vs K use tablebase.kpk_result instead — it is offline and instant.
  • C6: pace the requests (the module already pauses between uncached probes) and expect the run to take several minutes; Wilson intervals for a proportion p of n are in Appendix E.

Part D — Judgment & Transfer ⭐⭐⭐

D1. A 1200-rated club player asks whether to spend her limited study time on openings or on this chapter. Use the chapter's data (endgame reach rates by band, the ACPL-by-phase table, the theory-vs-practice results) to give her an honest answer, including what the data cannot tell you.

Discussion

At 1200, fewer games reach the endgame (Lichess blitz 45.4% below 1200, rapid 41.9%) and middlegame losses are by far the largest (ACPL 113.5 vs 69.5 in the endgame in blitz), so tactics and blunder-checking will usually pay off faster. But the reference positions of this chapter are few, cheap to learn and permanent, and the share of games reaching an endgame rises with every rating band; learning them now pays every year after. The data cannot show cause and effect — we have no before/after measurement of anyone studying endgames — so present this as a judgement, not a measured return.

D2. At FIDE 2400+, a pawn ending one pawn up is won only 43.9% of the time OTB, against 80.4% at 1600–1799. Does this mean strong players play pawn endings worse?

Discussion

No. The statistic is about pairs of players. At 2400+ the defender is strong too and holds more theoretically drawn positions (draws 49.8% vs 14.6%); strong players also enter pawn endings a pawn down only when they know they hold. The side ahead loses about equally rarely at both levels (6.2% vs 5.0%). What changes is the defender.

D3. Your engine shows +4.6 in a rook ending with seven men on the board. Your friend says "it's winning". What would you check, and why?

Discussion

Probe the tablebase: with seven men or fewer the exact result exists. The engine's +4.6 is a search estimate — in our Tarrasch pair it was +4.61 at depth 16 for a genuine win, but rook endings with similar scores can be fortresses (draws). Also check the DTZ against the 50-move counter if the game has gone long.

D4. Lena traded queens in a position where 14 of 28 moves won and reached one where all 9 moves won. Formulate the general principle and give one situation where following it blindly would be a mistake.

Discussion

Principle: when ahead, prefer simplifications that reduce the number of ways to go wrong — trade into an ending you can count. A mistake: trading into a theoretically drawn ending (bishop + wrong rook pawn, a rook pawn against a king in the corner, a queen against a c-pawn on the seventh with your king far away). The principle is "trade into a won ending you understand", not "trade whenever ahead".

D5. A teammate says: "Endgame study is useless online — at blitz nobody plays the endgame properly anyway." Use section 14.8's numbers to agree or disagree.

Discussion

Partly agree, mostly disagree. It is true that online results deviate from theory far more than OTB results (20.4% of won K+P vs K not won, R+P vs R draws held only 47.4% in our sample). But that is exactly why knowledge pays more online: your opponents are giving away half-points in positions you can count, and players who know the method convert faster, which also protects them against the clock. The data shows the size of the opportunity, not a reason to skip it.


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

M1 (with Chapter 6). In Chapter 6 we measured how imbalances score in real games. Pick two imbalances from this chapter that the 1/3/3/5/9 scale misjudges completely and explain the geometry behind each.

M2 (with Chapter 2). A passed pawn is a structural plus (Chapter 2). Using the Tarrasch pair and the a7 set-up, explain how the placement of the rooks decides whether that plus becomes a win. Then name a pawn-structure decision in the middlegame that should be influenced by this.

M3 (with Chapter 13). Chapter 13 measured how errors rise when the clock runs low. Design a small study that combines [%clk] with tablebase.check_line to test whether K+P vs K errors in Lichess blitz occur mostly with less than 10 seconds left. State the data, the filter, the measure and one confounder.

M4 (with Chapter 7). Prophylaxis means asking "what does my opponent want?" (Chapter 7). Show that the Philidor defence is a prophylactic idea: what does White want, and how does the third-rank rook stop it before it happens?

M5 (with Chapter 10). The Lucena bridge is a short forcing sequence. Write it as a calculation tree in the style of Chapter 10 (candidate moves, forcing replies) from the position after 1.Rd1+ Ke7, including Black's alternative 2...Ke6 instead of 2...Ra1. (Check every branch with check_line.)

Hints for Part M
  • M1: K+B or K+N vs K (+3, a draw), K+N+N vs K (+6, no forced mate), bishop + wrong rook pawn (+4, a draw if the king reaches the corner) — the geometry is the unreachable corner square or the missing mating net.
  • M2: rook behind the passer = win, rooks reversed = draw (14.6); in the a7 set-up the defender's king square decides. Middlegame consequence: when you create a passed pawn, keep (or bring) a rook behind it before trading the other pieces.
  • M3: data = Lichess blitz games in code/kpk_games.csv with movetext; filter = first K+P vs K position, pawn side's moves; measure = share of win-to-draw moves made with < 10 s vs ≥ 10 s; confounder = players short of time may also be weaker or in worse positions (compare within rating bands).
  • M4: White wants his king on the sixth rank in front of the pawn; the third-rank rook makes that square unreachable before White tries — prevention, not reaction.
  • M5: after 2...Ke6 the tablebase's own line continues 3.Kc7 Rc2+ 4.Kb6 Rf2 5.Rb4 — the rook swings from d4 to b4 to shield its king on the b-file; verify each branch with check_line.

Part E — Research & Extension ⭐⭐⭐⭐

E1. Your personal endgame census. Download your last 300 games (Outpost's games.fetch_user_games, Chapter 1) and measure: how many reached a book endgame, a pawn ending, R+P vs R; how many K+P vs K and R+P vs R positions you reached that were theoretically won or drawn; and how often your result matched the verdict. Compare with the pool in section 14.8 for your speed and band.

E2. An offline tablebase. Download the 3–5-piece Syzygy files and adapt outpost/tablebase.py to probe them locally with python-chess's chess.syzygy module, falling back to the online service for six and seven men. Verify that your local probe agrees with the online one on the chapter's whole library.

E3. Extend the solver. Generalise KPKSolver to K+P vs K+P on the same file (blocked pawns) or to K+R vs K, and verify against the online tablebase on a random sample, as section 14.2 did. Report the longest forced win you find and compare it with the tablebase's DTM.