Menu

#3 Fallback solver

open
nobody
None
5
2007-12-19
2007-12-19
No

It would be nice if, given a sudoku that can't be solved with the known algorithms, pysdk would (maybe optionally, e.g., -f for "force solution"?) revert to some kind of guaranteed solver.

The easiest thing to add would be a dumb backtracker. Once you're stumped, pick the first incomplete position, iterate through all possible values, and run the solver recursively on the result. Any success is an immediate success on the original puzzle (unless you need to detect ambiguous sudokus); failure means that value is ruled out, and you can go to the next one.

If you want, I think I could implement it pretty quickly and submit a patch.

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.