Legal move sequences in the first 3 turns of chess

Three plies give 8,902 sequences. Three full moves each give 119,060,324. Which one you want depends on what “turn” means.

Updated · 5 min read

First, what counts as a turn

Chess programmers count in plies. One ply is one move by one player. White’s first move is ply 1, Black’s reply is ply 2. A “full move” in the notation you see in books is two plies: one by White and one by Black.

So “the first 3 turns” can mean three different things:

  • 3 plies: White, Black, White.
  • 5 plies: White has moved three times and Black twice.
  • 6 plies: three full moves, so each side has moved three times.

This post gives the answer for all of them. The question also asks about sequences, meaning distinct lists of moves, which is what this kind of counting normally measures.

Estimate it first

The first step is exact and you can verify it with the rules. White can move any of eight pawns one or two squares, which is 16 moves, plus two knights with two moves each, which is 4. So White has 20 opening moves.

Black has the same 20 replies whatever White chose, so after two plies there are 20 × 20 = 400 sequences.

Now for ply 3, you have to guess. Pieces start to open up as soon as a pawn moves, so White has a few more options than 20. Guess an average of about 22 moves per ply from here on:

  • 3 plies: 22 × 22 × 22 = 10,648 sequences
  • 6 plies: 226 = 113,379,904 sequences, about 113 million

If you keep the number at a flat 20 per ply, you get 203 = 8,000 and 206 = 64 million. The second figure turns out to be too low, because the number of moves keeps rising as pieces are freed.

The real counts

Programmers check move-generation code by counting every legal move sequence to a fixed depth, a test called perft. The Chess Programming Wiki’s perft results and the OEIS sequence A048987 (“Number of possible chess games at the end of the n-th ply”) list the same numbers from the starting position:

PliesPossible move sequencesGrowth from the previous ply
12020 ×
240020 ×
38,90222.3 ×
4197,28122.2 ×
54,865,60924.7 ×
6119,060,32424.5 ×
73,195,901,86026.8 ×
884,998,978,95626.6 ×

The answers to the question, then:

  • 3 plies: 8,902 sequences.
  • 5 plies (White moves three times): 4,865,609 sequences.
  • 6 plies (three full moves each): 119,060,324 sequences, about 119 million.

How the estimate did

With 22 moves per ply, the 3-ply guess of 10,648 was 20% above the real 8,902, and the 6-ply guess of about 113.4 million was 5% below the real 119.1 million. The flat 20 per ply did worse at six plies: 64 million is about 46% below the true count.

The reason is in the right-hand column of the table. The growth per ply is not constant. It starts at 20 and creeps up toward 25 or more as bishops, queens and rooks gain open lines. Over six plies, the average growth works out to about 22.2 per ply (119,060,324 to the power of one sixth), which is why 22 was a good middle number.

One more detail from the OEIS entry: the sequence “does not include games which end in fewer than n plies.” The fastest possible checkmate, the fool’s mate, takes four plies, so this exclusion only starts to matter at 5 plies and beyond. The 3-ply and 4-ply figures are not affected.

Where the Shannon number fits

The counts above stop at a few plies. A full game is far longer. In 1950 Claude Shannon, in “Programming a computer for playing chess,” made a back-of-the-envelope estimate. As summarised by the Chess Programming Wiki, he assumed about 103 (1,000) possibilities for each pair of moves, one by White and one by Black, and a typical game of about 40 such pairs:

  • 1,00040 = 10120

That is the Shannon number, described as a conservative lower bound on the game-tree complexity of chess. A later estimate by Allis, based on an average of 35 moves per position and an average game length of 80, gives at least 10123, according to Wikipedia.

You can check Shannon’s assumption against the table. Three full moves each give 119,060,324 sequences, which is about 492 per pair of moves (the cube root of 119,060,324). That is about half of Shannon’s 1,000. The opening is more restricted than the middle game, so the real branching starts below his average and rises.

Test your own sense of scale

The jump from 400 to 119 million in only six plies is a good example of exponential growth, which human intuition handles poorly. For a similar exercise with a physical object, compare a chess king and a chessboard in the game, or browse sports and games gear. The One Number estimate each day asks for the same sort of reasoning. Related reading: what a Fermi problem is and how big a billion really is.

Sources

Questions and answers

How many different first moves does White have?

20. Each of the eight pawns can move one or two squares, which is 16 moves, and each of the two knights has two possible squares, which is 4 more. Black then also has 20 replies, and the total after both sides have moved once is 400.

How many possible chess games are there?

Nobody knows exactly. Claude Shannon’s 1950 rough estimate, now called the Shannon number, is about 10^120 possible games, and it is described as a conservative lower bound. For comparison, the number of legal positions has been estimated at about 4.8 × 10^44 by Tromp and Österlund.

Why do different sites give different answers for the first three turns?

Because “turn” can mean a single move by one player (a ply) or a pair of moves, one each. After 3 plies there are 8,902 possible sequences. After 3 full moves for each side (6 plies) there are 119,060,324. Some sites also count positions instead of sequences, which gives smaller numbers.