Skip to main content

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}
}

Metadata

Release files for anti-sudoku 0.1.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 anti-sudoku 0.1.1
File Size Uploaded
anti_sudoku-0.1.1.tar.gz 22.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for anti-sudoku 0.1.1
File Interpreter ABI Platform
anti_sudoku-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 50.5 kB

Release files / anti_sudoku-0.1.1.tar.gz

Download URL anti_sudoku-0.1.1.tar.gz
Size 22.3 kB
Tags Source
SHA-256 checksum
How to use checksums
c978ae30b3fa8dc4f554d2ad1c27aef53a258231e8da4eec141d995e0015ca29
BLAKE2b-256 checksum
How to use checksums
e974b0a0d8fa0670e217c53f2e5b07fec4fa13d2b7e52402040e628bc5513a6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / anti_sudoku-0.1.1-py3-none-any.whl

Download URL anti_sudoku-0.1.1-py3-none-any.whl
Size 28.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af0435bcd4f49dda54859801a9dc3b8e55b08dc8bfec763ad5531c0591cd65f6
BLAKE2b-256 checksum
How to use checksums
70c03e5d1923ff36b9f73eb39ac960342b94762c0efc5d676660efe0b2e81c9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

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