Solve All the Sudoku, Leave No Joy for Solving by Yourself
Project description
Solve all the sudoku, leave no joy for solving by yourself
Why struggle for hours when you can solve any Sudoku in milliseconds? Just paste it in, hit Solve, and get on with your life. Your addiction ends here — and it feels great.
If you have a friend addicted to Sudoku, share this with them! ;)
Setup
Requirements: Python 3.9+
# Install from PyPI
pip install anti-sudoku
# Or install from source
git clone https://github.com/yuhhong/Anti-addiction_Sudoku.git
cd Anti-addiction_Sudoku
pip install .
Web UI
The web UI lets you generate puzzles or type one in manually, then solve it — or get step-by-step hints.
anti-sudoku serve
Opens http://localhost:8000 in your browser automatically. Both the page and the API are served together.
Features
- Generate mode — pick a difficulty (Easy / Hard / Master / Grandmaster) and click Generate to load a fresh puzzle
- Manual Input mode — click any cell and type a digit to enter your own puzzle
- Solve — fills the entire board instantly
- Hint — fills one cell and tells you which technique was used (e.g. "Row 4, Col 7 = 3 — X-Wing")
- Clear — resets the board
CLI
# Solve a puzzle file
anti-sudoku solve anti_sudoku/puzzles/hard_001.txt
# Solve from a string (dots = blank cells)
anti-sudoku solve --input "53..7...."
# Generate a puzzle and print it
anti-sudoku generate --difficulty grandmaster
# Reproducible generation with a seed
anti-sudoku generate --difficulty hard --seed 42
# Start the web UI
anti-sudoku serve
anti-sudoku serve --host 0.0.0.0 --port 9000 --no-browser
Difficulty levels: easy · hard · master · grandmaster
Python Package
from anti_sudoku import solve, hint, generate
# Generate a puzzle (returns 81-char string, dots = blank)
puzzle = generate(difficulty="hard")
puzzle = generate(difficulty="grandmaster", seed=42) # reproducible
# Solve a puzzle
solution = solve(puzzle) # pass the string back in
solution = solve([0,5,3,0,...]) # or a list of 81 ints (0 = blank)
# Returns same type as input, or None if unsolvable
# Get one hint at a time
h = hint(puzzle)
# {"row": 3, "col": 6, "value": 7, "technique": "Hidden Single"}
Supported input formats
| Format | Example |
|---|---|
| 81-char string | "53..7.486..." — digits 1-9, dots for blank |
| list of 81 ints | [5,3,0,0,7,0,4,8,6,...] — 0 for blank |
Hint techniques
The hint function uses the simplest technique that currently applies:
| Technique | Description |
|---|---|
| Naked Single | Only one candidate remains in a cell |
| Hidden Single | A digit has only one valid position in a group |
| Naked Pairs/Triples | N cells share exactly N candidates — eliminate from rest of group |
| Hidden Pairs/Triples | N digits confined to N cells — eliminate other candidates from those cells |
| Pointing Pairs | Digit in a block confined to one row/col — eliminate outside the block |
| X-Wing | Digit in 2 rows shares the same 2 columns — eliminate from those columns |
| Swordfish | X-Wing extended to 3 rows/columns |
| Backtracking | Used only when no deterministic technique applies |
Puzzle files
Built-in puzzles are in anti_sudoku/puzzles/. Format: space-separated digits, - for blank cells.
- 1 4 - 9 - - 7 -
8 - - 4 - - - 6 3
...
Reference
@inproceedings{simonis2005sudoku,
title={Sudoku as a constraint problem},
author={Simonis, Helmut},
booktitle={CP Workshop on modeling and reformulating Constraint Satisfaction Problems},
volume={12},
pages={13--27},
year={2005},
organization={Citeseer}
}
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
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 anti_sudoku-0.1.1.tar.gz.
File metadata
- Download URL: anti_sudoku-0.1.1.tar.gz
- Upload date:
- Size: 22.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c978ae30b3fa8dc4f554d2ad1c27aef53a258231e8da4eec141d995e0015ca29
|
|
| MD5 |
24e07841bc38c828c81c3ad8a4bb75da
|
|
| BLAKE2b-256 |
e974b0a0d8fa0670e217c53f2e5b07fec4fa13d2b7e52402040e628bc5513a6d
|
File details
Details for the file anti_sudoku-0.1.1-py3-none-any.whl.
File metadata
- Download URL: anti_sudoku-0.1.1-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af0435bcd4f49dda54859801a9dc3b8e55b08dc8bfec763ad5531c0591cd65f6
|
|
| MD5 |
1ecb5aa5418b3ae1861b50e15c8574a9
|
|
| BLAKE2b-256 |
70c03e5d1923ff36b9f73eb39ac960342b94762c0efc5d676660efe0b2e81c9a
|