https://github.com/hartwork/constraint-sudoku-solver
:game_die: Simple command line Sudoku solver making use of the python-constraint library
https://github.com/hartwork/constraint-sudoku-solver
Last synced: over 1 year ago
JSON representation
:game_die: Simple command line Sudoku solver making use of the python-constraint library
- Host: GitHub
- URL: https://github.com/hartwork/constraint-sudoku-solver
- Owner: hartwork
- Created: 2015-05-09T23:10:11.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-09T23:52:35.000Z (about 11 years ago)
- Last Synced: 2025-02-08T23:16:11.194Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 121 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.asciidoc
Awesome Lists containing this project
README
About
-----
*constraint-sudoku-solver* is
* a simple https://en.wikipedia.org/wiki/Sudoku[Sudoku] solver
* making use of
https://labix.org/python-constraint[the python-constraint library]
* licensed under the
https://www.gnu.org/licenses/agpl-3.0.html[GNU _Affero_ General Public License 3.0 or later].
Usage
-----
This is how to feed a puzzle to the solver:
--------------------------------------------------------------------------------
# cat examples/single_solution.txt
_ _ _ | _ 6 8 | _ 1 _
1 _ _ | _ _ _ | 7 _ _
_ 4 3 | 2 _ _ | 5 _ _
------+-------+------
3 _ _ | _ _ _ | 4 _ _
8 _ _ | _ _ _ | _ _ 9
_ _ 1 | _ _ _ | _ _ 6
------+-------+------
_ _ 6 | _ _ 4 | 8 5 _
_ _ 2 | _ _ _ | _ _ 7
_ 1 _ | 5 9 _ | _ _ _
# ./constraint-sudoku-solver examples/single_solution.txt
Trying to solve...
Solution:
2 7 5 | 9 6 8 | 3 1 4
1 8 9 | 4 3 5 | 7 6 2
6 4 3 | 2 7 1 | 5 9 8
------+-------+------
3 2 7 | 6 1 9 | 4 8 5
8 6 4 | 7 5 2 | 1 3 9
9 5 1 | 8 4 3 | 2 7 6
------+-------+------
7 9 6 | 3 2 4 | 8 5 1
5 3 2 | 1 8 6 | 9 4 7
4 1 8 | 5 9 7 | 6 2 3
Took 0.032 seconds to find.
Given problem IS a true Sokudo.
--------------------------------------------------------------------------------
For more options, check the `--help` output:
--------------------------------------------------------------------------------
# ./constraint-sudoku-solver --help
usage: constraint-sudoku-solver [-h] [--echo] [--duration SECONDS] FILE
positional arguments:
FILE file with puzzle to solve (see examples for puzzle
syntax)
optional arguments:
-h, --help show this help message and exit
--echo dump puzzle about to solve
--duration SECONDS seconds to stop searching for additional solutions after
(default: 0.1)
--------------------------------------------------------------------------------