eight queens puzzle

(redirected from N-queens problem)
Also found in: Acronyms.

eight queens puzzle

(algorithm)
A puzzle in which one has to place eight queens on a chessboard such that no queen is attacking any other, i.e. no two queens occupy the same row, column or diagonal. One may have to produce all possible such configurations or just one.

It is a common students assignment to devise a program to solve the eight queens puzzle. The brute force algorithm tries all 64*63*62*61*60*59*58*57 = 178,462,987,637,760 possible layouts of eight pieces on a chessboard to see which ones meet the criterion. More intelligent algorithms use the fact that there are only ten positions for the first queen that are not reflections of each other, and that the first queen leaves at most 42 safe squares, giving only 10*42*41*40*39*38*37*36 = 1,359,707,731,200 layouts to try, and so on.

The puzzle may be varied with different number of pieces and different size boards.

References in periodicals archive ?
That system performed even better than the original GDS scheduler/constraint satisfaction system (on the n-queens problem where GDS was able to solve 1 thousand queens problems in 11 minutes, the new min-conflicts systems solved 1 million queens in less than 4 (using comparable computational resources).
Since the min-conflicts approach "blew away" prior techniques on the benchmark n-queens problem by an over four orders of magnitude performance improvement, it clearly indicated a new focus for the field.
The N-queens problem consists in placing N queens on an NxN board in such a way that they do not attacks one another [5][7][12].
An initial solution to the N-queens problem, using an sequential algorithm, consists in trying all possible location combinations of the queens on the board, keeping those that are valid and disrupting the search whenever this is not achieved.