8-Queens Problem: Place eight queens on an 8x8 chessboard so that no two queens attack each other – that is, no two share the same row, column, or diagonal.
We can define a heuristic for the number of attacking queen pairs:
- We can interpret as a valid solution.
- Note that we are counting the number of pairs, not the diagonals
For the board below, there are 3 queens on the main diagonal, which creates conflicts. There are two additional conflicts. Thus, the total .

We could define a second heuristic as:
- Once the queen at column 2 is conflict free
For the board above:
- Conflicts exist among queens in columns:
- Only the queen at column 2 is conflict-free.
- Therefore,