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 board of 8 by 8?

the answer, and why

the answer is A

The method checks squares row by row and goes back 105 times, whenever a row has no square left to try, until every row of the 8 by 8 board holds a queen: 876 checks in all.

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, and going back checks some again.
  • That is 8!8!, the boards with one queen a row and a column.

new numbersthe test page's numbers

question 2

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

the answer, and why

the answer is B

The method goes back 105 times on 8 by 8. It puts a queen down 71 times and moves one along its row 42 times: 113 in all.

if you chose another

  • That is the queens in the answer, with no going back.
  • That is one queen on every square.
  • That is 8!8!, the boards with one queen a row and a column.

new numbersthe test page's numbers