Perl Sudoku anyone?

brian_d_foy on 2006-01-04T19:28:14

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.


search.cpan.org

itub on 2006-01-04T19:38:39

I see four sudoku modules in cpan: http://search.cpan.org/search?query=sudoku . I'd try contacting the authors. :)

I did

fishbot on 2006-01-04T20:01:49

brian - I wrote one over Christmas as a brain-exercise. I'm doing a talk for kw.pm 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"

Re:I did

runrig on 2006-01-04T20:35:27

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.

Re:I did

link on 2006-01-04T21:50:44

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.

sudoku == crack;

jbodoni on 2006-01-04T21:27:30

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.

John

Simon's

Smylers on 2006-01-04T22:24:51

Simon Cozens wrote a Sudoku solver last summer.

Smylers

how about generating them?

perrin on 2006-01-05T19:24:49

Is it possible to programmatically generate new ones rather than solve them? That would be more useful for the people who actually play them.

Re:how about generating them?

fishbot on 2006-01-06T16:24:04

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.

Re:how about generating them?

slushpupie on 2006-01-20T02:03:51

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 could use some template or some symetry rules to get a nice looking board. Difficulty can often be gauged by how many itterations of the various algorithms used are needed to complete the puzzle from a given state.

Funny Story

pudge on 2006-01-10T22:41:32

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.