A Sudoku solver and generator with GUI and CLI support
Project description
sudoku9
A Sudoku solver and puzzle generator with CLI and GUI support.
Built with PyQt6, rich, and qdarktheme for a beautiful user experience.
✨ Features
- 🔥 Solve Sudoku puzzles via the command-line or Python imports.
- 🎲 Generate new Sudoku puzzles with selectable difficulty (
easy,medium,hard). - 🖥️ Play Sudoku interactively via a GUI built with PyQt6.
- 🎨 Stylish and colorful CLI output using
rich.
📦 Installation
Install from PyPI:
pip install sudoku9
🚀 Usage
- CLI (Command Line) After installation, use sudoku9 command from your terminal.
➡️ Generate a new puzzle
sudoku9 new easy
(If no difficulty is specified, defaults to medium.) Output:
- A nicely formatted table view of the unsolved new Sudoku.
- The new Sudoku as a single string:
86392...4,92..1..6.,.148.392.,..9..214.,..2147.89,.4.......,.3.5.....,5..4.1.3.,4..238...
➡️ Solve a puzzle from a string
sudoku9 solve "53..7....","6..195...",".98....6.","8...6...3","4..8.3..1","7...2...6",".6....28.","...419..5","....8..79"
Output:
- A nicely formatted table view of the solved Sudoku.
- The solved Sudoku as a single string:
534678912,672195348,198342567,859761423,426853791,713924856,961537284,287419635,345286179
➡️ Solve a puzzle from a file
sudoku9 solve -f <path/to/puzzle.txt>
(The file should contain 9 lines, each with 9 characters.)
➡️ Play Sudoku with GUI
sudoku9 play hard
(Default difficulty is medium if not specified.)
- As a Python Module You can import and use sudoku9 programmatically in your own scripts.
➡️ Example: Solve a Sudoku puzzle
from sudoku9 import SudokuSolver
# Define a Sudoku board
board = [
"53..7....",
"6..195...",
".98....6.",
"8...6...3",
"4..8.3..1",
"7...2...6",
".6....28.",
"...419..5",
"....8..79",
]
solver = SudokuSolver(board)
solved_board = solver.solve()
for row in solved_board:
print(" ".join(row))
➡️ Example: Generate a Sudoku puzzle
from sudoku9 import SudokuGenerator
generator = SudokuGenerator(difficulty="hard")
puzzle = generator.get_puzzle()
for row in puzzle:
print(" ".join(row))
🌟 Author
Kunal Kumar GitHub
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 sudoku9-0.1.0.tar.gz.
File metadata
- Download URL: sudoku9-0.1.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf570ca3c07816345115b01577b6c0d857cbab6f6cdcf8a635bcb58ad1bb4120
|
|
| MD5 |
354784bc0fd762ed84121c5cd1979371
|
|
| BLAKE2b-256 |
10a4a4287535d21fd693d49a325afeaff06c26b0262326e38cdbb2c76ca0aefb
|
File details
Details for the file sudoku9-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sudoku9-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0a0edd7151d7c36662ea5ec41985047873b6b7621068d71b8b795216a015d06
|
|
| MD5 |
a6b8e3a82b9f4537f4f31b1470caf0d6
|
|
| BLAKE2b-256 |
3f3850ad4857bfb8b56ddb74811cc86d61392c3941cf83b358ebb0516b7556bf
|