GridPencil
11

Eight Queens

Place eight chess queens on the board so that no queen can capture another.

About Eight Queens

The Eight Queens puzzle was first posed in 1848, and it has kept mathematicians and programmers busy ever since. The board is a standard eight by eight chessboard. The queen is the most powerful piece in chess. Eight of them have to share the board in peace.

How it works

Since a queen controls her whole row and column, each row and each column must end up with exactly one queen. The difficulty is the diagonals. Any pair that can attack each other is shown in red, and the status line counts how many queens are involved, so you can see at once whether a placement has caused trouble.

There are 92 different solutions, so you are looking for any one of them, not a single hidden answer.

Solving tips

Work a row at a time, from the top down. Put one queen in each row and you never have to think about rows again.

Avoid the long diagonals. A queen in a corner or on the main diagonal covers a great many squares. Good solutions tend to have queens scattered in knight's-move relationships: two along and one down from the last.

Try this start. Place queens in the first four rows at columns 2, 4, 6 and 8. Then begin the second half at column 1 and continue the same stepping pattern. This kind of staircase is the basis of many solutions, though it usually needs one or two adjustments.

When you get stuck with seven queens and no room for the eighth, do not clear the board. Move the most recently placed queen to its next safe square and continue. Backing up one step at a time is exactly how a computer solves it.

It is a small, quiet puzzle, and one of the classic thinking HTML5 games.