Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

Wednesday January 04, 2006
02:28 PM

Perl Sudoku anyone?

[ #28237 ]

Anyone written a Sudoku solver in Perl? I'd sure like to get an article about that into The Perl Review. I can barely leave the house now-a-days without seeing someone playing one of those.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I see four sudoku modules in cpan: [] . I'd try contacting the authors. :)
  • brian - I wrote one over Christmas as a brain-exercise. I'm doing a talk for about it and puzzle-solving in Perl in general. I was going to do some research on other solutions. I can write an article if you are intersted.

    fishbot => "Eric Maki"
    • There must have been something in the air. I did it too []. Though it'll have to wait 'till I get home to forward it to brian.
    • Sudoku solvers must be the modern day equivalent of web templating engines. I wrote one a few months ago but it is far too ugly to show anyone.
  • I might as well make this [] my home page.

    My record time so far on Easy level is 2:41. Medium is somewhere between 5 and 7 minutes, can't remember. Hard and Evil scare me.


  • Simon Cozens wrote a Sudoku solver last summer [].


  • Is it possible to programmatically generate new ones rather than solve them? That would be more useful for the people who actually play them.
    • I believe so... I was starting to figure out how to get my program to guage the difficulty of a given puzzle. It can already determine if a given puzzle is solvable and unambiguous. And it is easy to generate a completed matrix. The only challenge is coming up with a good strategy for deciding what to reveal as a clue and what to leave blank. Just doing it randomly and iteratively would be graceless and expensive.
      • I had just picked up Sudoku when I was on the Geek Cruise with Brian a few months back and was toying with a solver then (I have a fairly well working, though slow, solver now). An interesting theory Ive seen used to generate Sudoku is to first generate a solved board. Most solvers will work on an empty board, just pick random places to "guess" and pick the first solution that comes up. After that, its just a matter of removing certain spaces. True Sudoku always has some pattern to the board, so you coul
  • I had never heard of or seen this until last November when I was on the plane. The guy next to me was playing it, and I tried to divine the rules from what he was doing. I failed. I turned to my copy of National Review, and read it. One of the articles I read over the next half hour was about ... Sudoku. WEIRD.