Skip to main content

Sudokugen

Package for solving and generating sudoku puzzles!

Setup

$ pip install sudokugen

or

$ git clone https://github.com/g-k-l/sudoku-gen.git
$ cd sudoku-gen
$ pip install .

Usage

Solver

>>> from sudokugen.solver import solve

>>> my_puzzle = [[0, 3, 6, 8, 9, 2, 7, 1, 5],
                 [5, 0, 2, 0, 7, 1, 9, 0, 3],
                 [9, 0, 7, 5, 6, 3, 4, 8, 2],
                 [0, 4, 3, 1, 5, 8, 2, 0, 7],
                 [8, 5, 9, 6, 0, 7, 1, 3, 0],
                 [7, 2, 0, 9, 3, 4, 8, 5, 6],
                 [0, 0, 0, 2, 8, 6, 5, 0, 1],
                 [0, 0, 0, 3, 1, 0, 0, 4, 9],
                 [0, 0, 0, 7, 4, 9, 3, 2, 8]]

>>> solution = solve(my_puzzle)

And solution looks like:

[[4, 3, 6, 8, 9, 2, 7, 1, 5],
 [5, 8, 2, 4, 7, 1, 9, 6, 3],
 [9, 1, 7, 5, 6, 3, 4, 8, 2],
 [6, 4, 3, 1, 5, 8, 2, 9, 7],
 [8, 5, 9, 6, 2, 7, 1, 3, 4],
 [7, 2, 1, 9, 3, 4, 8, 5, 6],
 [3, 9, 4, 2, 8, 6, 5, 7, 1],
 [2, 7, 8, 3, 1, 5, 6, 4, 9],
 [1, 6, 5, 7, 4, 9, 3, 2, 8]]

Puzzle Generator

from sudokugen.generator import generate, Difficulty

new_puzzle = generate(difficulty=Difficulty.MEDIUM)

Difficulty refers to the number of cells which have values assigned in the beginning. For MEDIUM, this number is 24.

Release files for sudokugen 0.2.1

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

Source distribution (sdist)

Source distribution for sudokugen 0.2.1
File Size Uploaded
sudokugen-0.2.1.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sudokugen 0.2.1
File Interpreter ABI Platform
sudokugen-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 26.2 kB

Release files / sudokugen-0.2.1.tar.gz

Download URL sudokugen-0.2.1.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
27ab57d427516b49569ec0b9f0dfcedfb0016a40e168ba68b9fac24cb6109d92
BLAKE2b-256 checksum
How to use checksums
8f2683e382e5328039a8b5e470caaa1776a6e0a312a744188c3bd89495ef56fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.9

Release files / sudokugen-0.2.1-py3-none-any.whl

Download URL sudokugen-0.2.1-py3-none-any.whl
Size 20.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fec4e67f3a687fb3081e6a4b6ea1c258a80bc7940ca4e3cf150017e541efc18f
BLAKE2b-256 checksum
How to use checksums
70e803a7b4a788465b02c2f10a93c87cbc7d321fc8a62144af806d939566fbf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.9

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1

2 release files

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