[Index]

JavaScript Sudoku Solver

Sudoku is a puzzle that appears in my local newspaper. As humans are asked to do, the script in this page attempts to fill in the grid so that every row, every column, and every 3x3 box contains the digits 1 through 9. You may be able to improve your Sudoku solving skills by studying the steps toward a solution produced by this script.

To use the script, fill in the cells in the initial grid with the values from your puzzle, and then push the solve button. A generated grid cell contains either a non-zero digit when the value of the cell has been determined, a sequence of non-zero digits when the digits omitted have been eliminated as possibilities, or a period when no possibilities have been eliminated. A cell contains a question mark if the grid is inconsistent.

A puzzle written in text can be loaded into the initial grid. Paste the puzzle into the multiple row text area below the grid, and then push the load button. The script ignores white space, and the characters hyphen, vertical bar, and plus sign. It also ignores comments surrounded by parentheses. What should be left is eighty-one non-zero digits and periods, which are entered into the initial grid.

Copyright © 2005 John D. Ramsdell. This web page, including its inline JavaScript program, is free software made available under the terms of the GNU General Public License. You are encouraged to study the source code, and either add your own solution strategies, or delete the ones it uses, and create your own complete set of strategies.

To solve the puzzle, press:

To clear table, press:

To load a puzzle as text, enter it below and press: