Skip to main content

Sudoku solver,that solves sudoku puzzles using constraint programming

Project description

license Build status GitHub stars

A sudoku solver that solves the puzzle using constraint programming


Installation through pip:

pip install kudosudoku

Installation through cloning:

git clone
cd kudoSudoku
python install


  • import class sudoku from the module.
  • pass puzzle to be solved as list of lists
  • sudoku has a method called solve( ) that returns the solved puzzle
  • output will be an object with the following keys
    1. done : “describing status if its done or not”
    2. iterations : “number of times puzzle is re visited”
    3. guesses : “number of places where it had to guess”
    4. timeTaken : “Time taken to conclude”
    5. solution : “Final answer(will be a list of list of integers)”


To solve this sudoku

a 2x2 sudoku

Input has to be:


As python language is case sensitive,you have to import kudoSudoku,not kudosudoku.

from kudoSudoku import sudoku
puzzle = [[0,2,4,0],[1,0,0,3],[4,0,0,2],[0,1,3,0]]
table = sudoku(puzzle)
result = table.solve()


{'done': True, 'iterations': 2, 'guesses': 0, 'timeTaken': 0.0013199988754573474, 'solution': [[3, 2, 4, 1], [1, 4, 2, 3], [4, 3, 1, 2], [2, 1, 3, 4]]}

2X2 sudoku is taken just to demonstrate. It works for any nxn sudoku

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for kudosudoku, version 1.0.2
Filename, size File type Python version Upload date Hashes
Filename, size kudosudoku-1.0.2.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page