8 Queens Puzzle
No queen may attack another. Solutions
Queens 0 / 80:00
Tap a square to place a queen
How to play the 8 Queens Puzzle
- Place 8 queens on an 8×8 chessboard so that no two queens attack each other. A queen moves any number of squares along its row, its column or a diagonal, so no two queens may share a row, a column or a diagonal.
- Tap a square to place a queen, and tap a queen to remove it. Queens that attack each other turn red and are joined by a dotted line.
- With “Attacked” on, every square a queen can reach is striped, so the plain squares are the safe ones.
- Stuck? “Hint” points out two queens that attack each other, a queen to remove when the position can’t be finished, or a square for the next queen.
- There are 92 solutions on the 8×8 board. Every solution you find is saved under “Found”, where you can see them all. You can also play 4×4 to 10×10 boards: this general version is called the N-Queens problem.
- The Daily puzzle is the same for everyone. A few white queens are already on the board and can’t be moved; place the rest. There is exactly one solution.
- On a computer, move with the arrow keys, press Enter or Space to place or remove a queen, H for a hint, and U or Ctrl+Z to undo. Your boards are saved, so you can pick up where you left off.
Tips
- Each row and each column holds exactly one queen, so think of it as choosing one square in every row.
- Fill the row with the fewest safe squares first. If a row has only one plain square left, the queen has to go there.
- Corners are rarely right: only 16 of the 92 solutions use a corner square.
- When a row has no safe square left, move the last queen you placed to its next safe square. If it has none, go back one more queen. This is called backtracking.
How many solutions are there?
The 8×8 board has 92 solutions in all. See every one of them, the 12 unique ones, and how backtracking (the last tip above) finds them:
About the 8 Queens Puzzle
The puzzle was first posed in 1848 by the chess composer Max Bezzel, and in 1850 Franz Nauck published the first solutions. Many mathematicians, including Carl Friedrich Gauss, worked on it. In 1972 Edsger Dijkstra used it to illustrate structured programming, with a depth-first backtracking algorithm.