Solving Every Sudoku Puzzle (2006)
11–20 of 101 posts
Re: Solving Every Sudoku Puzzle (2006)
#12I love it how with the Z3Py solver you just write down a few constraints (rows, columns, 3x3 boxes and the given values) and you immediately get an answer. [0] https://ericpony.github.io/z3py-tutorial/guide-examples.htm [1] https://yurichev.com/writings/SAT_SMT_by_example.pdf
Re: Solving Every Sudoku Puzzle (2006)
#13Sudoku solvers are near and dear to my heart. They’re my go to problem when learning a new programming language because they’re just complex enough to exercise a whole bunch of different language features. I built this when I wanted to learn Swift and dip my toe into machine learning: https://twitter.com/braddwyer/status/910030265006923776?s=21
Re: Solving Every Sudoku Puzzle (2006)
#14Here's the paper describing the algorithm: https://arxiv.org/pdf/cs/0011047.pdf
Re: Solving Every Sudoku Puzzle (2006)
#15The array deepcopy isn't too bad, at least when writing code, it compressed into a neat slice [:]
I wrote a hinter[2] which was more fun than the actual solver too, because it shows the "minimum remaining values" as a colour coded chart.
Re: Solving Every Sudoku Puzzle (2006)
#16Sudoku solvers are near and dear to my heart. They’re my go to problem when learning a new programming language because they’re just complex enough to exercise a whole bunch of different language features. I built this when I wanted to learn Swift and dip my toe into machine learning: https://twitter.com/braddwyer/status/910030265006923776?s=21
Re: Solving Every Sudoku Puzzle (2006)
#17Wrote a solver using basically the same idea back in college. Was kind of fun. Probably some stupid things in there that I would do differently now with more experience. https://github.com/war1025/sudoku-solver/blob/master/Sudoku/...
Same. Didn't save the code; wish I had just so I could see if I got a better execution time than his 1439 second example. Amusingly, my rationale was much like the author's; I freakin' hate Sudoku. So the fact it's such an obvious candidate to have an automated solver for meant I wrote one (it was also an excuse to do something more meaningful than the intro to CS exercises that class had me doing).
Re: Solving Every Sudoku Puzzle (2006)
#18On a related note, Knuth has a cool algorithm to solve exact coverage problems like sudoku (similar logic as Norvig's DFS but implemented very differently). It's more work to code it than Norvig's but worth it for the education:) (and it solves faster) Here's the paper describing the algorithm: https://arxiv.org/pdf/cs/0011047.pdf
Re: Solving Every Sudoku Puzzle (2006)
#19On a related note, Knuth has a cool algorithm to solve exact coverage problems like sudoku (similar logic as Norvig's DFS but implemented very differently). It's more work to code it than Norvig's but worth it for the education:) (and it solves faster) Here's the paper describing the algorithm: https://arxiv.org/pdf/cs/0011047.pdf
While dancing links is cool, when benchmarking it turns out using bits to represent values, and just copying, ends up being faster. This is because on modern CPUs about the worst thing you can do is lots of pointer following.
How much faster does it get? I'm genuinely curious
Re: Solving Every Sudoku Puzzle (2006)
#20That's hilarious! But what puzzles, or even activities wouldn't be classified by Ben as a DOS on humans?