Excellent job! Looping through the possible moves is essentially doing a depth first search of the possible positions. Have you considered trying to solve using bit boards? It might be fun for you.
If you don't know, a bit board is simply a 64-bit integer that has a 1 or 0 for each square on the board. For this problem you could have a bit board representing the location of all queens currently on the board (1s for squares with queens and 0s for empty squares). You could then have a bit board representing all positions that would be under attack by a queen if placed in a certain square. Performing a bitwise AND between those two bit boards will result in a 0 if no queen would be under attack in that position or a number >0 if at least one queen would be under attack. The advantage of this is that it doesn't require looping and bitwise operations take a single clock cycle on a 64bit processor.
Bit boards are very common for game theory in games played on 8x8 grids.

## Recent Comments

2011/3/20

Eight Queen Problem