Not Equal to Each Other?

ale.of.ginger at gmail.com ale.of.ginger at gmail.com
Thu Nov 3 20:01:08 EST 2005


Another question:  I am writing a sudoku solving program.  The
'solving' part of is just multiple iterations.  It will take random
numbers and keep switching it all around until a set of logic
statements has been met (ie; all numbers in a row are not equal to each
other) ... that's where my question comes in.

Cellboard = my list for storing each row/column's data.

Rather than writing

cellboard[0] is not* (cellboard[1] and cellboard[2] and cellboard[3]
and cellboard[4] ... cellboard[8])
cellboard[1] is not (cellboard[0] and cellboard[2] and cellboard[3] and
cellboard[4] ... cellboard[8])
etc...

* should this be != ?

the above so that all the data in one row is not equal to each other,
is there something I can write to make it simpler?  For example,
(cellboard[0] is not cellboard[1] is not ... cellboard[8]) only worked
for the numbers to the left and right of the cell - is there anyway I
can expand this to cover all numbers in a set range?




More information about the Python-list mailing list