Check out Grant Acedrex, our featured variant for April, 2024.

The Eight Queens problem

The Eight Queens problem is a classic puzzle, based on chess. The task is to put eight queens on an otherwise empty eight by eight chessboard, such that no queen can take another queen.

The problem is probably quite old, but I have no information to its exact origins. It is sometimes used in computer science classes as an example for the use of certain programming techniques.

Task

Take an empty chess board (size 8 by 8), and put eight queens on the chess board, such that no queen attacks another queen: i.e., no two queens may be on the same horizontal, vertical, or diagonal line.

Below, you see an example for a 4 by 4 board.

Solution

Try to find the solution yourself. If you cannot find it, look at a solution.
Written by Hans Bodlaender.
WWW page created: February 17, 2000.