♛ Eight Queens

Place eight queens on the board so that no two attack each other: no shared row, column, or diagonal. Then watch a computer solve it by backtracking.

Click a square to place a queen.

About the puzzle

The chess composer Max Bezzel posed the eight queens puzzle in 1848. Franz Nauck published the first complete set of solutions in 1850 and asked the same question for any size of board. Carl Friedrich Gauss worked on it too.

There are 92 solutions on an 8 × 8 board, but only 12 are truly different: the rest are rotations or mirror images of those 12. A 2 × 2 or 3 × 3 board has no solution at all.

In 1972 the computer scientist Edsger Dijkstra used this puzzle to explain backtracking: build a solution one step at a time, and undo the most recent step as soon as it cannot lead anywhere. The same idea solves Sudoku, mazes, and scheduling problems.