prinzstani / SudokuSolver

Program that solves Sudokus like humans do
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

Sudoku Solver

This Sudoku Solver is a web page that allows you to type your sudoku problems, and that will help you solve them. The solver follows a human-centered approach by applying rules all the way. It will also indicate which rules are used during the solving process. There is no guessing involved in the process, and sometimes the solver does not find any applicable rules and cannot solve the problem.

Current version

You can run the current version at the run page.

You find the code for the current version at the repository.

What it does

Sudoku solver simply solves sudoku puzzles. It applies a number of rules that also human solvers would apply. If no more rules are applicable, the solving process fails. The solving process emplys a notion of field, which could be a row, a block, or a column of the sudoku. The following rules are implemented.

Simple rules

The solver employs the following simple rules for reducing the number of options.

Shared cells between fields

If two fields share more than 1 cell, and for one field, some number only appears in the shared cells, then also for the other field, this number can only appear in the shared fields.

Example: Consider a block and a row that overlap in their first three cells with the following options:

Now the row has the 1 only in the shared cells, such that in the block, also the cells with 1 outside the shared cells have to be removed. This will remove the 1 from the alternative (16), and this will trigger another rule.

Complete groups of alternatives

If there are n cells within a field that together only have n alternatives for their numbers, then this number cannot appear in any other cell in the same field.

Example: Consider a field with the following cell options: (12) (23) (13) (34) (45) (569) (679) (789) (89). Here, (12), (23), (13) are three cells that together only have three options (123), which means that (123) cannot appear anywhere else. This again means that the option (34) has to be reduced to (4), which triggers another rule.

Bugs and suggestions

Any bug or suggestion should be created as an issue for easier tracking. This allows to follow the status of the issue.

All suggestions are welcome, even the smallest ones.

Contributors