in reply to Trying to solve N-Queens
There has to be a pop @TEMP when we backtrack to the previous column, whether a solution is found or not. This should automatically clear @TEMP when we backtrack to the 1st column, making the @TEMP = (); line unecessary.
I0 has posted code above that corrects this problem, I believe.
On a side note, it appears you would be including non-distinct (AKA congruent) solutions in your results. Is this a concern?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Trying to solve N-Queens
by Solo (Deacon) on Sep 09, 2002 at 04:00 UTC |