N-Queens as a CSP
e.g. when n = 8…
- place 8 queens on a 8x8 chessboard so that no two attack each other
Variable xi for each row i of the board
Domain = {1, 2, 3 … , n} for position in row
Constraints are:
- xi ? xj queens not in same column
- xi - xj ? i-j queens not in same SE diagonal
- xj - xi ? i - j queens not in SW diagonal