Puzzle 6: A Profusion of Queens

Can you place N queens on a board with N columns and N rows so no two queens threaten each other? The 8 queens problem on a chessboard is a special case. Prof. Devadas describes a general solution to the N queens problem that uses recursive backtracking search.

Flash and JavaScript are required for this feature.

Puzzle Description

Python Code

Assignment

  • Do one or more of the exercises in A Profusion of Queens puzzle.

Solution

Programming Constructs and Algorithmic Paradigms Covered in this Puzzle

  • Recursive procedures
  • Exhaustive search through recursion