Skip to main content

kudoSudoku

license Build status GitHub stars

A sudoku solver that solves the puzzle using constraint programming

Installation

Installation through pip:

pip install kudosudoku

Installation through cloning:

git clone https://github.com/Varshneyabhushan/kudoSudoku.git
cd kudoSudoku
python setup.py install

Usage

  • 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)”

Example

To solve this sudoku

a 2x2 sudoku

Input has to be:

[[0,2,4,0],[1,0,0,3],[4,0,0,2],[0,1,3,0]]

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()
print(result)

Output:

{'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

Metadata

Release files for kudosudoku 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kudosudoku 1.0.2
File Size Uploaded Provenance
kudosudoku-1.0.2.tar.gz 4.8 kB Without provenance Details

Release files / kudosudoku-1.0.2.tar.gz

Download URL kudosudoku-1.0.2.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4b9f3bca03f9c18290dee3a7b996918892af497c17f17977a22fa8a026561aef
BLAKE2b-256 checksum
How to use checksums
7791ae255806f02ba7c9db5ac62e2ae5ccca65fd139eaaae5a8cf2e618120e48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for kudosudoku 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page