Project Examples: A Sudoku Solver Implementation
Code Examples: SudokuPuzzle.h and SudokuPuzzle.cpp
Some minor changes were made to the code in order to accommodate the new input system. The grid that exists in the GUI is separate from the Sudoku puzzle that exists in memory as it was written for the C++ command-line application. There are simple methods in the Actionscript code that syncs the grid with the puzzle in memory.
The interface is very simple. Click on any box to enter a number. The solver will only accept valid entries. If an entry is not valid, the puzzle will not accept it. Any box that you click on will generate a list of valid candidates to assist the solver.
There are limitations that were carried over from the C++ code to the Actionscript version. For starters, if the solver is executed with too few given clues, then the solver has the potential to run for hours. I've added a check to the solver. If there are too many potential solutions, the solver will stop running and allow the user to keep editing the puzzle.
I've had successful test cases where 17 clues were given and over 4,000 solutions were found. The solver did not stop. In a case where 16 clues were given, and this was a very poorly designed puzzle, the solver stopped immediately.
This tool was designed to assist players in completing difficult Sudoku puzzles that are well-designed. Poorly designed puzzles may be unsolvable or contain too many potential solutions in order to let the solver generate them in a reasonable amount time (less than 3 minutes). If a poorly designed puzzle is entered, do not expect a solution to be found.
Please, feel free to test the new GUI for Sudoku Master. Still on my wish list is an algorithm that will generate new puzzles for users to try and solve, and the ability to save and load puzzles. For now, the existing framework will do for a small applet that will assist in solving puzzles.