In article <[EMAIL PROTECTED]>, Stelios Xanthakis <[EMAIL PROTECTED]> wrote: > In the sudoku solver, there is a min (number, object) which is > probably what's affected by the extistance of the dummy variable. > Now, in sudoku puzzles some times the algorithm has to suppose > that in a box the right solution is one of the possible, try it > and if it fails then try the other one. I guess that the result > of from the different 'min' leads the solver to first try the > correct solution in the fast case and therefore need not attempt > the wrong one. Or at least this is what I think that happens.
Thank you! That does indeed seem to be the explanation. The min() line looks for the shortest `constraint'; that is, the box with the fewest possible symbols, or the symbol with the smallest number of possible positions within a given row, column or block; the code below that line then tries all possibilities for this constraint. The line should really be something like min(c for c in rowitems(h), key = lambda c: c.S) but that isn't going to work until Python 2.5 comes out, and I was too lazy to expand the whole thing properly instead of using the cheap trick I did. Thanks again for clearing up this confusion. Mark -- http://mail.python.org/mailman/listinfo/python-list