This applet is an aid to solving SuDoKu puzzles. It doesn't generate puzzles. Rather, it allows you to track the consequences of the settings in each cell of the SuSoKu grid, so that a solution can be found. Once you have set up a particular puzzle, you can usually automatically solve the puzzle.
The rules follow that of SuDoKu. Each 3x3 square needs to be assigned numbers from 1 to 9. A number may not be repeated either in a 3x3 square, in a full row or a full column.
Right-click on a square to set the value of the square. You will be presented with a pop-up menu of possibilities, with numbers that have been used elsewhere greyed out. When you set a square, it will affect the rest of the square and the row and column that it is on by removing the value you have set from consideration. By eliminating possibilities, you will, eventually, end up with a singleton, a square that can only have one value.
The squares have colours that have the following meanings:
When singletons appear, you can press the Step button to fill out all the singletons in one go.
You can use the Undo button to reverse back one step; either manually setting the
How it Works
Despite the nonsense on the SuDoKu site, of course SuDoKu uses mathematics. Mathematics is based on the application of deductive logic to formal systems. SuDoKu is a formal system and you use deductive logic to solve it.
Each cell in the SuDoKu grid is part of a square, a row and a column. Each cell starts with the full range of 1-9 as possibilites. When a cell is fixed to a particular value, the other cells in the square, row and column have that possibility removed.
When a cell can only have one possible value, it becomes a singleton and can be fixed to the singleton value. There are two ways of becoming a singleton. Firstly, all the other possibilities can be removed from the cell. Secondly, and more likely, the cell can be the only cell in a square, row or column which still has a value as a possibility, in which case the cell has to have that value.
There is another possible deduction. If a row or column in a square is the only row or column that can have a possible value, then that value can be eliminated from other squares in the row/column. Since the first two rules seem to solve even hard SuDoKu puzzles, this deduction has not yet been implemented.
The solution strategy described above follows the Andorra Principle of logic programming: do the deterministic bits first and then make a choice. Each step eliminates all the deterministic choices, possibly creating new ones as it does so.
As each choice is made, by picking a value for a cell or hitting the step button, a choice-point is created. As a cell has a possibility eliminated, is fixed or becomes a singleton, the action is trailed. To undo, the trail is rewound back to the nearest choice point, setting things back to the way they were.
In theory, the rest of the Andorra Principle could be implemented, with the program searching through choices and automatically making choices and rewinding. In practise, this has yet to be needed.
Using the Applet
To use the applet, embed the following HTML:
<object codebase="http://yourserver.com/sudoku" archive="sudoku.jar" classid="java:org.charvolant.sudoku.gui.SudokuApplet.class" type="application/x-java-applet" width="400" height="500"> <param name="size" value="4"/> Su|Do|Ku Applet </object>
The size parameter can be set to 4, 9, 16 or 25. Although only 9, the standard size, seems to give a particularly satisfying game.
Source code is made available under the MIT License.
28-Nov-2005 Doug Palmer