https://github.com/neehan/sudoku-solver
A solver that solves most sudoku boards under 1 millisecond
https://github.com/neehan/sudoku-solver
c-plus-plus fast-sudoku-solver sudoku sudoku-puzzle sudoku-solver
Last synced: 2 months ago
JSON representation
A solver that solves most sudoku boards under 1 millisecond
- Host: GitHub
- URL: https://github.com/neehan/sudoku-solver
- Owner: Neehan
- License: other
- Created: 2014-12-24T05:14:29.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-07-02T12:00:39.000Z (almost 8 years ago)
- Last Synced: 2025-01-05T17:13:28.388Z (4 months ago)
- Topics: c-plus-plus, fast-sudoku-solver, sudoku, sudoku-puzzle, sudoku-solver
- Language: C++
- Homepage:
- Size: 105 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Sudoku-Solver
==============
[](https://travis-ci.org/Neehan/Sudoku-Solver)This is a very fast sudoku solver that solves most sudokus under 1 millisecond.
How to install
---------------
Download [the latest release](http://www.github.com/Neehan/Sudoku-Solver/releases) of `Sudoku-Solver`, and run it. Alternatively, you can run the [`Makefile`](Makefile) to build from source.How to use
-----------
Feed this program your sudoku from `stdinput`. Blank cells has to be replaced by either `0` or `.`. The program will discard all other characters and wait until 81 valid inputs (for 81 cells of your sudoku) have been provided.Example
--------
Let us solve the following sudoku with `Sudoku-Solver`.
```
+-------+-------+-------+
| 1 . . | 9 2 . | . . . |
| 5 2 4 | . 1 . | . . . |
| . . . | . . . | . 7 . |
+-------+-------+-------+
| . 5 . | . . 8 | 1 . . |
| . . . | . . . | . . . |
| 4 . 2 | 7 . . | . 9 . |
+-------+-------+-------+
| . 6 . | . . . | . . . |
| . . . | . 3 . | 9 4 5 |
| . . . | . 7 1 | . . 6 |
+-------+-------+-------+
```
**Note: The given sudoku must have _at least_ one solution.**
## Input
```
1 . . 9 2 . . . .
5 2 4 . 1 . . . .
. . . . . . . 7 .
. 5 . . . 8 1 . .
. . . . . . . . .
4 . 2 7 . . . 9 .
. 6 . . . . . . .
. . . . 3 . 9 4 5
. . . . 7 1 . . 6
```
## Output
```
+-------+-------+-------+
| 1 7 8 | 9 2 6 | 4 5 3 |
| 5 2 4 | 3 1 7 | 8 6 9 |
| 9 3 6 | 8 4 5 | 2 7 1 |
+-------+-------+-------+
| 6 5 7 | 2 9 8 | 1 3 4 |
| 8 9 3 | 1 6 4 | 5 2 7 |
| 4 1 2 | 7 5 3 | 6 9 8 |
+-------+-------+-------+
| 3 6 5 | 4 8 9 | 7 1 2 |
| 7 8 1 | 6 3 2 | 9 4 5 |
| 2 4 9 | 5 7 1 | 3 8 6 |
+-------+-------+-------+Execution time: 0.000593 s
```
## License
This software is published under GPL version 3. See the [`LICENSE`](LICENSE) for details.