A Python library for solving and validating Sudoku puzzles.
Project description
Sudoku Helper
A Python library for solving and validating Sudoku puzzles programmatically.
Features
- Solve standard 9x9 Sudoku puzzles step-by-step
- Validate Sudoku grids
- Check for unique solutions
- Easy to use as a Python library
Installation
From PyPI (recommended)
pip install sudoku-helper
Development install (from source)
git clone https://github.com/yourusername/sudoku-helper.git
cd sudoku-helper
pip install -r requirements.txt
Usage
Import the library and use its functions in your Python code:
from sudoku_helper.validator import is_valid, has_one_solution
from sudoku_helper.solver import next_step
# Example 9x9 Sudoku grid (None for empty cells)
grid = [
[5, 3, None, None, 7, None, None, None, None],
[6, None, None, 1, 9, 5, None, None, None],
[None, 9, 8, None, None, None, None, 6, None],
[8, None, None, None, 6, None, None, None, 3],
[4, None, None, 8, None, 3, None, None, 1],
[7, None, None, None, 2, None, None, None, 6],
[None, 6, None, None, None, None, 2, 8, None],
[None, None, None, 4, 1, 9, None, None, 5],
[None, None, None, None, 8, None, None, 7, 9],
]
# Validate the grid
print(is_valid(grid))
# Check for unique solution
print(has_one_solution(grid))
# Get the next logical solving step
step = next_step(grid)
if step:
print(f"Cells: {step.cells}")
print(f"Technique: {step.technique}")
print(f"Explanation: {step.explanation}")
else:
print("No further logical steps found.")
Contributing
Pull requests are welcome. Please ensure your code passes all tests and Snyk scans.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sudoku_helper-0.1.0.tar.gz
(3.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sudoku_helper-0.1.0.tar.gz.
File metadata
- Download URL: sudoku_helper-0.1.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c0e708806f7d71a6a75a29f8e8f7bc0acea68c15aec031e0a0a6507064fd93b
|
|
| MD5 |
209f5580fc3d1fb41a1260a3cb3482c0
|
|
| BLAKE2b-256 |
8af35bfafcc85d46d4a775aef1fb575e0294a1560ff69f1dc284123ad0da450b
|
File details
Details for the file sudoku_helper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sudoku_helper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.2.1 CPython/3.11.14 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d59583f13076a0e9774e797a2a24feae1635c34188ec4416141e072fd6d14019
|
|
| MD5 |
1019e85211252895154826df1d4b08de
|
|
| BLAKE2b-256 |
c614e98ba8f6186b40819cd331dff1670ff238fe199c437d02df3fba57ba0a14
|