On Tue, Nov 11, 2008 at 2:32 AM, Kaz Kylheku <kkylheku / gmail.com> wrote:
> On 2008-11-11, brabuhr / gmail.com <brabuhr / gmail.com> wrote:
>> I haven't take the time to look at difficulty level, but have a very
>> naive generator; the basic idea is to generate a puzzle using a sudoku
>> solver and then punch some random holes in it:
>
> [...]
>
>> 72.times{puzzle[rand(81)] = 0}
>
> [...]
>
> An obvious way to improve your generator would be to call the solver function
> after punching a hole. (The solver function hopefully tells you that the
> puzzle has two or more solutions, right?) If after punching a hole, the puzzle
> has more than one solution, then backtrack; restore the hole, and punch out a
> different number.

Yes, that was my next step, but I never got around to it this past
weekend.  The third solver 'sudoku-x' apparently can report multiple
solutions (the others are too brute-force to populate the blank board
in any reasonable time on any hardware I have).  Keeping with the
random theme, the next planned iteration was like:

    64 times
        pick a random spot
        skip it if it is already a hole
        poke a hole and pass the puzzle to the solver
        if
            the solver finds more than one solution
                put the number back and try another
            the solver finds one solution
                leave the number out and try another

And the next iteration would replace 64 with a number calculated from
difficulty level.  (I wasn't going to post at all, but I was afraid
from the second post from Matthew Moss that he was afraid that no one
was interested in the quiz.)