Monday, May 25, 2020

Solving the “Miracle Sudoku” in Prolog

Jason Kottke:

The solver himself calls it “a work of sublime genius” and “one of the most extraordinary puzzles we’ve ever seen”. It’s fascinating listening to him slowly uncover different aspects of the puzzle — watching him methodically figure out the 3s was genuinely thrilling.

Ben Congdon (via Hacker News):

Since Prolog is a declarative language, writing a Sudoku solver is remarkably concise. In essence, all the programmer needs to do is define the constraints of the game, and Prolog is smart enough to find solutions[…]

[…]

The cool thing about this code is that it works both as a Sudoku solver and as a Sudoku generator. You can query it with a partially solved board, and it will find all valid solutions.

[…]

Surprisingly, there are only 72 solution boards that meet the Miracle Sudoku constraints.

Comments RSS · Twitter

Leave a Comment