[kw-pm] Sudoku

Eric Maki eric at uc.org
Mon Jan 2 14:17:01 PST 2006


For Christmas, I got a Sudoku book from my mother-in-law (and
this fetching sweater).  Donning the sweater, I did three or four
before thinking: Perl would do this a lot faster.

( If you haven't heard of Sudoku:
http://en.wikipedia.org/wiki/Sudoku )

As a brain exercise, I wrote a surprisingly simple Perl program
to solve Sudoku.  It was indeed about 6000 times faster than me.

My hope is to be able to re-work the program to retain enough
information how it is solved to "grade" it's difficulty - and to
also weed out puzzles that are impossible or ambiguous - so that
it can build puzzles for me.  Then it can solve them for me too.

I'll share my solution, but more interesting (possibly):

 - why I love cheating on puzzles using Perl
 - how a real-live (not me) human decided that they liked the
   Perl solution better, and changed the way they solve Sudoku to
   match
 - other Sudoku/Perl solutions, including this humbling
   three-liner:
   http://www.ecclestoad.co.uk/blog/2005/06/02/sudoku_solver_in_three_lines_explained.html

Also, I'll start with another Perl solution to a brain teaser.

If anyone else has used Perl to solve puzzles, please email me
ahead of time, or bring code with them to share.

Daniel loves snappy titles, so I am hereby renaming this talk:
"Sudoku and Perl, or Why My Other Brain is an x86"

fishbot

---- original message : 2006-01-02 9:47pm : lloyd carr ----

So Eric what advance info are you willing to share on Perl and Sudoku?

- Lloyd


More information about the kw-pm mailing list