10 ms·
I had to solve Sudoku and similar puzzles at university using Prolog (and fell in love with it in the process). What really saddens me is that every Prolog syst
by Argorak 15y ago
I had to solve Sudoku and similar puzzles at university using Prolog (and fell in love with it in the process). What really saddens me is that every Prolog system ships with a constraint solver (some better, some not), yet many other languages don't have good bindings or libraries for constraint solving.
- rndmcnlly0 15y agoYou might enjoy answer set programming (ASP). It's a different take on logic programming based on the idea of automatically transforming your problem into a SAT-like representation and then running fancy conflict-driven constraint learning solvers on it. In many solvers, you give up Turing completeness in exchange for being really productive with solving NP-complete problems (similar to regex engines turning you into a bad-ass string matching programmer). Here's a tutorial application of ASP to map generation: http://eis-blog.ucsc.edu/2011/10/map-generation-speedrun/ http://eis-blog.ucsc.edu/2011/10/map-generation-speedrun/
- Argorak 15y agoThank you for the pointer. I wasn't aware of ASP and will definitely spend some time with it.
- rndmcnlly0 15y agoOh, and here's a sudoku solver in 15 source lines with ASP: http://asparagus.cs.uni-potsdam.de/encoding/show/id/3540 http://asparagus.cs.uni-potsdam.de/encoding/show/id/3540 Also, a sudoku puzzle generator directly incorporating the unique solution constraint: http://asparagus.cs.uni-potsdam.de/encoding/show/id/12739 http://asparagus.cs.uni-potsdam.de/encoding/show/id/12739
- abp 15y agoHere is one that has: https://github.com/clojure/core.logic https://github.com/clojure/core.logic