Engines
How chess engines think: from Turing's paper machine to NNUE
A modern chess engine will beat any human who has ever lived, and it does it on a phone. It is tempting to think of that as magic, but the core ideas are old, simple and surprisingly human. Understanding them makes you a better user of engines, and it explains why a raw engine line is often so hard to learn from.
Two questions every engine answers
Every classical chess program is built around two questions:
- How good is this position? That is the evaluation.
- What happens if I look ahead? That is the search.
A human does both at once without noticing. An engine separates them cleanly.
Turing and Shannon: chess on paper
Before there were computers fast enough to play, there were people describing how a computer would play. Around 1948 Alan Turing and David Champernowne wrote a set of rules for choosing chess moves, later called Turochamp. No machine could run it, so Turing played it by hand, working through the calculations himself, and the program lost its one recorded game.
In 1950 Claude Shannon published Programming a Computer for Playing Chess, the paper that framed the field. He described two strategies. A Type A program looks at every legal move to a fixed depth: brute force. A Type B program looks only at promising moves, deeper, the way a strong human does. For decades the argument between the two shaped computer chess. Brute force, helped by clever pruning and ever faster hardware, largely won; selective ideas came back later in different clothes.
Minimax: assume your opponent is good
Imagine every position as a node in a tree. From the current position, each legal move leads to a child position, and each of those has children of its own. At some depth you stop and evaluate the leaves.
Minimax is the rule for passing those numbers back up the tree. On your move, you pick the child with the highest score. On your opponent's move, you assume they pick the child with the lowest score, because what is good for them is bad for you. Alternate max and min all the way up and you get a score for the root, plus the move that leads to it.
It matches good practical chess: do not play a move that only works if your opponent misses something. The problem is size. A typical middlegame position has thirty to forty legal moves, so each extra move of lookahead multiplies the work by that much.
Alpha-beta: skip what cannot matter
Alpha-beta pruning, worked out by several researchers in the late 1950s and analysed thoroughly by Donald Knuth and Ronald Moore in 1975, is the trick that made deep search possible. It returns exactly the same answer as minimax but skips branches that cannot change the result.
The intuition: suppose you have already found a move that guarantees you at least a small advantage. You start looking at a second move, and the first reply you check for your opponent wins your queen. You do not need to look at their other replies. Whatever they are, this second move is already worse than the first one, so you can stop.
Alpha-beta works best when the best moves are searched first. So engines spend a great deal of effort on move ordering: captures and checks first, moves that were good in a previous search, "killer moves" that refuted a sibling branch. With good ordering an engine can search roughly twice as deep in the same time as plain minimax.
On top sit many refinements: iterative deepening, transposition tables that remember positions reached by different move orders, quiescence search so the engine never stops in the middle of an exchange, and aggressive pruning of moves that look unpromising, which is Shannon's Type B idea sneaking back in.
Evaluation: turning a position into a number
For most of computer chess history, evaluation was written by hand. Programmers added up material (a pawn is 1, a knight or bishop about 3, a rook 5, a queen 9) and then layered on hundreds of smaller terms: king safety, pawn structure, passed pawns, mobility, rooks on open files, the bishop pair. Each term had a weight, and tuning those weights was an art.
These evaluations are fast but brittle: they encode what their authors understood, and struggle with long-term sacrifices or fortresses.
Deep Blue: brute force wins a match
IBM's Deep Blue combined alpha-beta search with custom chess hardware that could examine an enormous number of positions per second. It lost a match to Garry Kasparov in 1996 and won the rematch in 1997. It was a very fast, very well engineered Type A searcher with a hand-tuned evaluation, and it proved that at chess, search plus a decent evaluation beats human judgement.
Stockfish: open source and relentless testing
Stockfish grew out of Glaurung, an open-source engine by Tord Romstad, and first appeared in 2008. What made it dominant was a process: every proposed change is tested over many thousands of games on volunteers' computers before it is accepted, and small proven gains add up year after year.
AlphaZero and Leela: learning instead of hand-tuning
In 2017 DeepMind's AlphaZero took a different path. It started with only the rules, played millions of games against itself, and trained a neural network to predict good moves and the likely result of a position. Instead of alpha-beta it used Monte Carlo tree search guided by that network, examining far fewer positions than Stockfish but judging each one much more richly.
AlphaZero itself was never released, but the open-source Leela Chess Zero project rebuilt the approach with volunteer computing and became one of the strongest engines in the world.
NNUE: the best of both
The next step came from shogi. In 2018 Yu Nasu introduced NNUE, an "efficiently updatable" neural network small enough to run on an ordinary CPU and designed so that, after a move, only a small part of the calculation has to be redone. In 2020 Stockfish replaced much of its handwritten evaluation with an NNUE network and gained a large jump in strength.
So today's strongest classical engine is a hybrid: Shannon-style alpha-beta search, refined over decades, with a learned evaluation at the leaves.
What this means for you as a player
Knowing how engines work changes how you should read them:
- The number is a summary, not an explanation. "+1.3" means the engine's search found that it prefers White by about a pawn and a bit. It does not say why.
- The best line is often inhuman. The engine chooses moves that hold up against perfect defence, which sometimes means a quiet, hard-to-find move where a human would play something natural and still be fine.
- Depth matters. A quick evaluation can change as the engine looks deeper. Treat shallow numbers in sharp positions with suspicion.
- Engines do not care about difficulty. A position where you must find five only-moves and a position where every sensible move wins can carry the same number.
That gap between "what the engine prefers" and "what a person can understand and repeat" is exactly where coaching comes in. The engine is the calculator. You still need someone, or something, to explain the arithmetic.