Project 2 – CSP – NQueens

Write a program that solves N-Queen in n*n grid.   Start with a random board, with one queen in each column.  Use iterative search algorithm.

Constraints:  10 <= n <= 1000

Input Format: A file with n lines; each line has the column location of the i-th row’s queen. Read the comments in the sample file. You have n-queen.txt as a sample file. You code should work with any n.

Algorithm

Write a CSP algorithm to solve this problem.  The CSP algorithm should have the following components:

  • Search algorithm to solve the CSP
  • Heuristics (min remaining values, least constraining value, tie breaking rules)
  • Constraint propagation using AC3.