nullprogram.com/blog/2010/10/20/
Over the last two evenings I created this, a Sudoku Java applet.
git clone git://github.com/skeeto/Sudoku.git
The hardest part was creating and implementing the algorithm for
generating new Sudokus. The first step to writing any Sudoku generator
is to write a Sudoku solver. Use it to
solve an empty board in a random order, then back off while
maintaining a single solution. For a proper Sudoku, this has to be
done symmetrically leaving no more than 32 givens.
I didn't work out a great way to determine the difficulty of a
particular puzzle. The proper way would probably be to solve it a few
different ways and measure the number of steps taken. Right now I'm
controlling difficulty by adjusting the number of givens: 24 (hard),
28 (medium), and 32 (easy). Harder puzzles take longer to generate
because the search-space is less dense, due to the strict constraints.