On Wed, 27 Jul 2005 at 10:15:25 -0400, Quantum Mechanic wrote:
> 1) Not strict and warnings clean.
> 2) perl -c on
> if( $puzmap[$bestpos] & 1 == 0 )
> gives:
> "Possible precedence problem on bitwise & operator at
> sudoku_ip.pl line ..."
Hmm... it's warning-clean on my 5.8.4 - what version are you using?
I turned on "use warnings 'all'" and "use strict", and all that came out
were some undeclared variables.
> The intended precedence seems to be
> if( ( $puzmap[$bestpos] & 1 ) == 0 )
> but this gives me:
> "Whoops - bestpos is a given square at..."
> Changing the precedence to
> if( $puzmap[$bestpos] & ( 1 == 0 )
... which is always false, of course.
The code intended is:
if( $puzmap[$bestpos] & 1 )
Wasn't much good as a diagnostic, was it? :-)
I've uploaded a revised version (1.3). This also runs faster, since I
inlined the single call to "countones", following a quick DProf run.
To be found in
http://homepage.ntlworld.com/phillipps/sodsolve
Ian