Puzzle 5: Keep Those Queens Apart

Can you place eight queens on a chessboard so no two queens threaten each other? Is this even possible? Prof. Devadas explains how to write a computer program to quickly and definitively answer this question.

Puzzle Description

Python Code


  • Do one or more of the exercises in the Keep Those Queens Apart puzzle.


Programming Constructs and Algorithmic Paradigms Covered in this Puzzle

  • Two-dimensional lists
  • While loops
  • Continue statements and argument defaults in procedures
  • Exhaustive search via iteration
  • Conflict detection

Course Info

Learning Resource Types

theaters Lecture Videos
assignment_turned_in Programming Assignments with Examples