Hello,
I think this program is running fine for classical 8 Queen problem. But i want others to review my code and point out mistakes. Please suggest my mistakes and optimisations that could be done to improve its performance.

Whenever placing a queen on the board, I would mark the squares it affects. (Since any square can and will be affected by many queens you could add one to affected squares and when removing the queen subtract one.) This way testing whether a square is attacked becomes very easy: you just see whether the value is one.

06-29-2009

chottachatri

Ok anon!
agreed but still "marking the squares attacked" would still mean the same, I mean i need to again repeat those four loops for "finding the squares attacked and incrementing its value by 1".? So how will that optimise my code?