Skip to content

Eight queens

puzzles

Level 2 of 3

Also called The eight queens puzzle and N queens, by backtracking.

fresh numbers

The test's questions that a run answers, asked again on new numbers whenever you like. The answer, its working and the reason for every other choice come from eight queens's own run on the numbers shown.

choose one

question 1

How many squares does the method check on a 4 by 4 board?

the answer, and why

the answer is A

a1 leads nowhere, so the method goes back four times before b1, d2, a3 and c4 fill the board. Section 5 counts all 26.

if you chose another

  • That is every square once. After going back, the method checks some squares again.
  • That is one square a row. Rows meet attacked squares first, as row 2 does under a1 with a2 and b2, and going back checks some again.
  • That is 4!4!, 4 times 3 times 2 times 1, the boards with one queen a row and a column.

new numbers

question 2

How many times does the method put a queen on a square on 6 by 6? A queen moved along its row counts again.

the answer, and why

the answer is B

The method goes back many times on 6 by 6, and every queen it puts on a square counts, moves included. Section 3's table: 31.

if you chose another

  • That is the queens in the answer, with no going back.
  • That is one queen on every square.
  • That is 6!6!, 6 times 5 and on down to 1, the boards with one queen a row and a column.

new numbers