Showing posts with label sudoku. Show all posts
Showing posts with label sudoku. Show all posts

Saturday, June 14, 2008

Sudoku solver, new and improved

If anyone enjoyed the Sudoku program I made earlier, I should let you know that it's been updated.

In the latest version you can click on the game board and type numbers directly into the screen, instead of messing around with the text box. You can still copy the contents on the text box and save them for later retrieval.

Also, the box now displays periods instead of spaces for empty squares. This way, the correct amount of white space doesn't disappear when you type it in an HTML comment. For instance, in a previous comment, Tatarize was trying to get me to try this puzzle:

1.......5
....3....
..2.4....
.........
.34...7..
...2.6..1
2....5...
.7.....3.
.....1...

Go ahead and paste that in... it's long, but still quick at maximum speed.

Tuesday, June 03, 2008

Sudoku!

As I mentioned two weeks ago, I started playing around with a Sudoku solving program. So finally, here it is. Your browser must have Java enabled to view it.



Brief instructions:

To watch the program solve a puzzle, click "Solve." You can enter new puzzles by typing numbers in the text box and clicking "update." I recommend going to websudoku.com, copying a hard puzzle, and cheating to get a fast time.

Future updates include (if I don't get too lazy):
  • The program doesn't validate the initial state, so you can enter an obviously unsolveable puzzle and it will waste a fair amount of time trying to solve it. This is my top priority for a fix.
  • I'd like to be able to click directly on the image and be able to type in numbers there.
  • No guarantees, but you might be able to paste a websudoku.com URL and have it automatically load the puzzle from there.
  • Kevin, the director of engineering, discussed some methods to automatically generate new puzzles. I might give that a try. But it's a solver, not a game, so I might not.
Updates: Validates puzzles correctly. "Maximum" option set on speed bar. Move counter added.

Monday, May 19, 2008

One reason I like my new job

On my schedule today, the director of engineering will be delivering a presentation with the following topic:
"Solving Sudoku puzzles with recursion"

Knowing this was coming, I started writing an experimental Java solver over the weekend. I had a pretty busy weekend, so I only got as far as reading a puzzle from a file and displaying it. During off-stage time at my two chorus performances, I worked out a possible algorithm in my head, but I'll need a few more days to write it out and debug. I'll probably put it in a Java applet on my web page when it's done, and you'll be able to watch it "think" if it works out the way I'm imagining it.