Skip to content

Tomin1/sudoku-solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sudoku Solver
Solves sudokus. Works as a library and a standalone program, though library 
usage could be improved. Can take advantage of multiprocessing.

Copyright (C), 2011-2012 Tomi Leppänen (aka Tomin)
The program is licensed under GPL v3
See LICENSE file for complete license.
More general info about GPL: http://www.gnu.org/copyleft/gpl.html

This version is called sophisticated

GENERAL:
--------------------------------------------------------------------------------
Solves most sudokus and prints all answers (unless -1 argument is specified). 
This program can use multithreading (see -t) and has a small commandline 
interface. Solver prints statusbar while running and uses suffixes like "k" for 
1000 to reduce space that statusbar needs.

If you have something to ask or praise about this program, you may want to 
email me at code (at) tomin.dy.fi or tomppeli12 (at) gmail.com

USAGE:
--------------------------------------------------------------------------------
Short list of arguments:
-h              displays list of arguments, similar to this list
-1              limits answers to only one
-t              use multiprocessing, uses as many threads as computer has 
                CPUs
-t<threads>     use multiprocessing, uses number of <threads> threads
-u              don't use suffixes in long numbers (k = 1000 and M = million)
-V              prints version and licensing information

Examples:
The sudoku I use in my examples is gotten from here: 
http://en.wikipedia.org/wiki/File:Sudoku_puzzle_hard_for_brute_force.jpg
I use ./solver.py as the command, but that can be basically anything depending 
on where you have saved your sudoku-solver and is it in PATH.

Solve a sudoku:
./solver.py ,,,,,,,,,,,,,,3,,8,5,,,1,,2,,,,,,,,5,,7,,,,,,4,,,,1,,,,9,,,,,,,,5,,,,,,,7,3,,,2,,1,,,,,,,,,4,,,,9

Use two threads and get only one answer:
./solver.py -t2 -1 ,,,,,,,,,,,,,,3,,8,5,,,1,,2,,,,,,,,5,,7,,,,,,4,,,,1,,,,9,,,,,,,,5,,,,,,,7,3,,,2,,1,,,,,,,,,4,,,,9

NOTES:
--------------------------------------------------------------------------------
If -t is specified and multithreading can't be imported it uses 
multithreading.dummy unless even that's not available.

Starting the program without -t and with -t1 aren't the same.

Don't try to solve sudokus that can't really be solved or you can but it will 
take a very long time and you'll run out of memory for sure.
For example
./solver.py ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
is impossible, because it would print all possible sudokus.

TO BE DONE:
--------------------------------------------------------------------------------
OpenCL support                          # Next

About

My old Sudoku Solver, multithreaded

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages