Blog · Queens Puzzle

The eight queens problem: from 1848 to color grids

Queens Puzzle App Store screenshot illustrating one queen per row and column

The eight queens problem asks for eight chess queens on a standard 8×8 board with no queen attacking another. The chess composer Max Bezzel proposed it in 1848, and it has kept mathematicians and programmers busy ever since. Modern color-grid queens puzzles grew up next to it, and comparing the two shows three rule changes that turn an open search into a puzzle with a single answer. Our source for the history is the Wikipedia article on the eight queens puzzle and the references it cites.

What exactly is the problem?

Place eight queens on a chessboard so that no two attack each other. A chess queen attacks along her row, her column and both diagonals, at any distance. So no two queens may share a row, a column or a diagonal.

With eight queens and eight rows, each row ends up with exactly one queen. Columns work the same way. The diagonals are what make it hard: there are fifteen running one way and fifteen the other, and each can hold at most one queen.

From Bezzel in 1848 to Nauck in 1850

Max Bezzel, a composer of chess problems, proposed the puzzle in 1848. Two years later, in 1850, Franz Nauck published solutions. Carl Friedrich Gauss is among the mathematicians who took an interest in it.

For the original publications, follow the references at the end of the Wikipedia article.

How many solutions are there?

Ninety-two. Many of them are the same layout seen from a different side: turn the board a quarter turn, or mirror it, and a solution stays a solution. Group those together and you’re left with 12 fundamental solutions.

Ninety-two is a lot for a puzzle. Hand someone an empty chessboard and ask for eight non-attacking queens, and any of 92 answers is correct. There’s no single answer to reason toward, so you try, back up, and try again. That’s the opposite of what a modern queens puzzle wants, and it’s the thread we pick up below.

Dijkstra, 1972, and backtracking

In 1972 Edsger Dijkstra used the eight queens problem to illustrate structured programming, with a depth-first backtracking method. The idea is simple to describe. Put a queen on the first safe square of row 1. Move to row 2 and do the same. Keep going row by row, and when a row has no safe square left, step back to the previous row and move that queen to its next safe square. Repeat until all eight rows are filled, or, if you want every solution, until the search has tried everything.

Notice what that program never does. It doesn’t reason about which square must hold a queen; it only checks whether a square is safe right now and backs out of dead ends.

It’s still a common exercise for anyone learning backtracking. Small enough to finish, big enough that blind trial and error gets painful fast.

Does every board size have a solution?

Almost every one. The general version, N-queens, asks for n non-attacking queens on an n×n board, and solutions exist for every n except 2 and 3. On a 2×2 board any two queens attack each other. On 3×3 there’s no room either: wherever two queens sit safely, the third has nowhere left to go.

What color-region puzzles change

One-star Star Battle, LinkedIn’s daily Queens and our own Queens Puzzle: Crown Logic all keep the one-per-row and one-per-column idea. Compared with the 1848 problem, they change three things.

Touching replaces full diagonals

Queens may share a diagonal as long as they aren’t neighbors. Queens at row 1, column 1 and row 3, column 3 break the eight queens rule and are perfectly fine in a queens puzzle. On an empty board that loosening allows more arrangements, not fewer: every one of the 92 classic solutions still works, and plenty of layouts the chess rule bans become legal.

Regions take away the free choice

The board is split into N color regions, and each must get exactly one queen. Regions are the setter’s tool. By shaping them, the setter (or, in our case, the generator) removes arrangements until just one survives.

An empty 8×8 Queens Puzzle board split into eight color regions
The same 8×8 grid as the 1848 problem, cut into eight regions so only one arrangement survives.

That moves the difficulty somewhere new. On Bezzel’s empty board, the hard part is keeping track of attacks while you search. On a region board, the shapes carry information before you’ve placed anything: a region pressed into one row, or a region of a single cell, already tells you something. Setting a good board means shaping regions so those clues turn up in a sensible order, each deduction opening the next.

One answer, reached by logic

A queens puzzle has exactly one solution, and our generator verifies that for every board. This turns the problem from search into deduction. Instead of trying placements and backing up the way Dijkstra’s program does, you rule cells out until only one queen fits each row, column and region. The rules explainer walks through a small board this way, and the solving techniques cover the patterns that scale up to 12×12.

One gap on our side: Queens Puzzle has no plain eight queens mode with full diagonal attacks. To try the 1848 version, a real chessboard and eight coins will do. For a side-by-side look at the modern variants, read Queens vs Sudoku, Star Battle and N-queens, or open a board in Queens Puzzle.

Questions

Frequently asked

How many solutions does the eight queens problem have?

Ninety-two in total. Count rotations and mirror images as one layout and twelve distinct arrangements remain.

Who invented the eight queens puzzle?

Max Bezzel, who composed chess problems, posed it in 1848. Franz Nauck printed answers to it in 1850.

Does N-queens work on every board size?

Every size but 2×2 and 3×3 has at least one valid layout. Those two boards are simply too cramped to keep the queens apart.

Is a color-grid queens game the same as the eight queens problem?

Related, not identical. Game boards add colored areas, forbid only neighboring queens on diagonals and are built around one answer; the chess problem bans whole diagonal lines and accepts many.