Start with a puzzle. In noughts and crosses, also called tic-tac-toe, can the first player force a win?
Most people know from childhood that the answer is no: with sensible play it is always a draw. But how would you prove it? The proof is the first of four ideas that took computers from that three-by-three grid to beating the best human players of chess and Go.
Idea one: look at everything
To prove the draw, list every possible game. After each move, list every reply, and every reply to that, until the board is full or someone has won. The result is a tree, with the empty board at the root and finished games at the tips.
Now work backwards from the tips. Label each finished game as a win, loss or draw for the first player. One step up, whoever is to move will choose the branch that is best for them. So a position where it is my move is as good as its best branch, and a position where it is your move is as good, for me, as its worst.
Carry those labels all the way up, and the root gets a label too. For noughts and crosses the label is "draw".
This procedure is called minimax: I maximise, you minimise, and we assume each other competent. It plays perfectly. It needs no insight into the game at all, only the rules and patience.
For noughts and crosses the tree has a few hundred thousand games, which a computer finishes instantly. The trouble starts when the board gets bigger.
Idea two: stop looking at nonsense
Chess has, on average, about thirty-five legal moves in a position, and games run to eighty moves or more. The full tree has more games than there are atoms in the observable universe. Looking at everything is not an option, and never will be.
The first relief is free. Suppose I have examined one move and found it leads to an even position. I start on a second move and discover that you have a reply that wins my queen. I can stop there. I do not need to know whether you have something even better, because I already have a reason not to play this.
That is alpha-beta pruning. It gives exactly the same answer as minimax and, with moves examined in a sensible order, lets a program look roughly twice as deep in the same time.
It is also how good human players think. They do not consider fewer moves because they are lazy. They stop considering a line the moment it is refuted.
Idea three: guess
Pruning helps, but chess still cannot be searched to the end. So the program looks ahead as far as it can, perhaps a dozen moves, and then has to judge a position where nothing has been decided.
That needs an evaluation function: a quick estimate of who stands better. For decades these were written by hand. Count the material, with a pawn worth one and a queen worth nine. Add something for controlling the centre, for a safe king, for pawns close to promotion.
A deep search with a crude evaluation turned out to be extremely strong. In 1997 the IBM machine Deep Blue beat the world champion, Garry Kasparov, in a six-game match, examining around two hundred million positions a second. It understood nothing in any human sense. It out-counted him.
Go resisted this approach completely. The board is nineteen by nineteen, there are some 250 legal moves in a typical position, and nobody could write down what makes a Go position good. Strong players spoke of shape and influence, and could not turn those words into arithmetic. Through the 2000s, the best programs played at the level of a decent amateur.
Idea four: let it teach itself
Two things broke the deadlock.
The first was a different way to search. In place of looking at every move to a fixed depth, play out many complete games from the current position, at first almost at random, and keep statistics on which first moves tend to lead to wins. Spend more of the playouts on the moves that are doing well, while still trying the others now and then. This is Monte Carlo tree search, and it needs no hand-written evaluation.
The second was neural networks: programs that learn a function from examples instead of having it written by a person. Give a network a position and train it to output two things, namely which moves look promising, and who is likely to win. The first narrows the search. The second replaces the hand-written evaluation.
Where do the examples come from? At first, from records of human games. Then from the program playing against itself. Each game produces positions and an outcome. The network is adjusted to predict those outcomes a little better, the improved network plays slightly stronger games, and those games become the next lessons.
In 2016 DeepMind's AlphaGo, built on these ideas, beat Lee Sedol, one of the strongest players in the world, four games to one. A later version, AlphaZero, was given only the rules of chess, Go and shogi and no human games at all. Within hours of self-play it was stronger than the best existing programs at each.
Some of its moves looked wrong to experts and turned out to be right. Human players have since changed how they play both games.
What this does and does not show
It is tempting to conclude that machines now think better than we do. The more careful conclusion is narrower and still remarkable.
These games share properties that suit the method: the rules are fixed and fully known, the whole situation is visible, there is a clear winner, and the program can play millions of games against itself at no cost. Most problems people care about lack at least one of those. There is no perfect simulator for a business, a patient or a city.
Games with hidden information and many players, such as poker, needed different techniques again, and were cracked later.
What transfers is the shape of the solution, which is worth stealing for your own problem-solving:
- Look ahead as far as you practically can.
- Stop early on any line you have already refuted.
- Estimate when you cannot calculate, and know that it is an estimate.
- Practise against yourself, keep score honestly, and adjust.
A puzzle to leave with
Fifteen coins lie on a table. Two players take turns removing one, two or three coins. Whoever takes the last coin wins. You move first. What do you take?
Do not guess. Work backwards from the end, the way minimax does. With one, two or three coins left, the player to move wins. With four, they lose, whatever they do. So what about five, six and seven? And eight?
The pattern appears within a minute, and with it the answer. It is the same reasoning that solved noughts and crosses, and, with a great deal more machinery around it, Go.



