David Little
Mathematics Department
Penn State University
Eberly College of Science
University Park, PA 16802
Office: 403 McAllister
Phone: (814) 865-3329
Fax: (814) 865-3735
e-mail:dlittle@psu.edu

Home Courses Math Links Resources Java Applets

Sudoku

The following applet can be used to create and/or solve any sudoku puzzle. To play a random game of sudoku, simply click on the "Random Puzzle" button. The applet will automatically clear the board and display a random puzzle with 30 given values. The difficulty of the puzzle will depend on the distribution and positions of these values. Each random puzzle is guaranteed to have at least one solution.

To solve the puzzle, simply click on any one of the possible values displayed in the remaining cells. The user can choose to have forced values highlighted in red to aid with finding a solution. Once a value has been selected, the applet will automatically eliminate this value from the remaining cells in the same row, column, and 3-by-3 block in the puzzle. If the value of the cell was forced by the value of other cells in the same row, column or 3-by-3 block, then the value will be displayed in red. The applet can also be set up to automatically select forced values after each selection made by the user.

If at any time there is a violation (i.e., no possible values for a given cell, no possible position for a specific number in a row, column or 3-by-3 block, etc.), the applet will automatically highlight the cells that are causing the violation. The user must then click on the "Undo Last Choice" button. Doing so will reset all of the cells up to and including the most recent cell where the user had a choice of the value. The value selected that led to the violation is highlighted in green so that the user will not select this value again.

Use the "Clear Board" button to erase the existing puzzle from the board. The user can then start creating his/her own puzzle or manually enter another puzzle from a different source and use the applet to solve the puzzle as described above.



© 2009 David P. Little