Key Takeaways — Chapter 34

Key Takeaways

  1. Every engine is search + evaluation. Shannon's 1950 design — generate moves, look ahead, score the leaves, back up the scores — still underlies Stockfish 19. What changed is how much is pruned and how the leaves are scored.
  2. Test the foundation first. perft counts legal move sequences (start position: 20 / 400 / 8,902 / 197,281 / 4,865,609). A generator that forgets en passant passes from the start position to depth 4 and fails in Kiwipete at depth 2 — test with rich positions.
  3. Alpha-beta gives the same answer for far less work — if you order moves well. Kasparov–Topalov at depth 3: 81,018 nodes for minimax, 1,832 for alpha-beta with captures first. Ordering alone was worth 3.9× at depth 3 and 8.5× at depth 4 in real OTB middlegames.
  4. Never evaluate in the middle of an exchange. Without quiescence the score swung +9 / 0 / +6 / 0 with depth; a real OTB position showed a depth-2 search giving up a rook (−4.91) because its lines ended half-way through the tactics.
  5. A little search beats a lot of static knowledge. engine_lab's static evaluation correlated 0.812 with Stockfish 19 over 240 real positions; three plies of search raised it to 0.901 (level-material positions: 0.325 → 0.751).
  6. Stockfish goes deep by pruning, not only by speed. It is about 37 times faster per node than our Python engine, but its effective branching factor of about 1.56 is what lets it reach depth 20 in under a million nodes.
  7. AlphaZero replaced hand-written knowledge with self-play learning (preprint December 2017, Science December 2018); Leela made the approach open source; NNUE (Yu Nasu, 2018; Stockfish 12, 2020) brought learned evaluation into alpha-beta, and Stockfish 16 (2023) dropped the hand-crafted evaluation.
  8. Deep Blue's 1997 key moves stand up today — 8.Nxe6 (game 6) and 37.Be4 (game 2) are Stockfish 19's first choices — but six-game matches prove that a machine could win, not which side was stronger.
  9. At the engine top, the opening decides many games. In TCEC top events in our data, White won 48.8% and Black 3.6%; in 22% of opening pairs White won both games.
  10. The engine is a tool, not a teacher. Game Changer's h-pawn theme is visible in elite games (12.8% → 15.9% of O-O vs O-O games), but the why behind any engine move is yours to build.

Principles & Metrics

Term Definition This chapter's value
perft(d) legal move sequences of exactly d plies start d4 = 197,281; Kiwipete d4 = 4,085,603
Minimax nodes every node to depth d KT 1999 d3 = 81,018
Alpha-beta saving minimax nodes / alpha-beta nodes 34.5× median at depth 3 (captures first)
Effective branching factor nodes(d) / nodes(d−1) Stockfish 19 ≈ 1.56 (d10–20); engine_lab ≈ 3.9–4.2
Quiescence share q-nodes / all nodes 93.5% at depth 5 (engine_lab)
Evaluation fit Pearson r with SF19 d12, 240 positions 0.796 material → 0.901 depth-3 search
Match score engine_lab vs SF19 at 1 / 100 / 1,000 nodes 58.3% / 33.3% / 12.5% (12 games each)
Engine draw rate TCEC top events vs 2700+ humans 47.6% vs 66.8%

Common Mistakes (with the fix)

Mistake Fix
Testing a move generator only from the start position Run perft on Kiwipete and other tricky positions; use perft_divide to localise errors
Comparing "depth" between engines State the engine and mode; Stockfish's depth is nominal and selective
Treating a 12-game match result as a rating Report a Wilson interval; ratings need many games against calibrated opponents
Reading an eval correlation as "material is 80% of chess" Check the subgroup that matters (level material: r = 0.325 static)
"Deep Blue beat Kasparov" Kasparov won 1996 4–2; Deep Blue won 1997 3½–2½
Mixing single-PV and multi-PV numbers Say which you quote; near-equal moves can swap order
Copying "AlphaZero moves" (h4–h5) everywhere Check whether the opponent has the pieces to exploit the squares left behind

Decision Checklist for the board

  1. Order: list checks, captures and threats first — for both sides.
  2. Finish exchanges: count every capture sequence to the end before judging material.
  3. Refute, then prune: one clear refutation is enough to drop a candidate move.
  4. Evaluate quiet positions with structure, activity, king safety and material.
  5. With an engine: note depth and mode, look at two depths when the verdict matters, and write down why the engine's move works before you accept it.