[Haskell-cafe] Code Review: Sudoku solver

Michael Hanus mh at informatik.uni-kiel.de
Thu Mar 23 03:24:51 EST 2006


Jared Updike wrote:
> On 3/22/06, David F. Place <d at vidplace.com> wrote:
> ...
> > It solves
> > sudoku puzzles.  (What pleasure do people get by doing these in their
> > heads?!?)
> >
> 
> They are probably asking the same question: why take hours to write a
> program to do it when with my mad sudoku solving skills I can solve it
> in X seconds? My roommate is like this.

I would say because they have chosen the wrong language for this
problem :-) Solving Sudoku is a typical finite domain constraint
problem. Thus, a language with constraint solving facilities
like Curry (a combination of Haskell and constraint logic programming)
is much better suited. Actually, I wrote a Sudoku solver in Curry
and the actual code for the solver is 10 lines of code which is
compact and well readable (if you are familiar with Haskell), see

http://www.informatik.uni-kiel.de/~curry/examples/CLP/sudoku.curry

Regards,

Michael


More information about the Haskell-Cafe mailing list