A Python-based Sudoku solver and explainer that uses logical strategies to solve puzzles step-by-step, providing human-readable explanations.
- Step-by-Step Explanations: Understand why a number goes in a cell.
- Strategies Implemented:
- Naked Single
- Hidden Single
- Naked Pair
- Web Interface:
- Modern, dark-themed UI.
- Interactive board with candidate visualization.
- "Easy Mode" (Hide Notes) for a cleaner look.
- Undo functionality.
- Sample puzzles (Easy, Medium, Hard).
- CLI: Run the solver from the command line.
This project uses uv for dependency management.
-
Install
uv(if not already installed):curl -LsSf https://astral.sh/uv/install.sh | sh -
Install Dependencies:
uv pip install -r requirements.txt
Start the web server:
python3 -m uvicorn web.app:app --reloadOpen http://127.0.0.1:8000 in your browser.
Run the solver on a specific puzzle:
python3 main.py --puzzle "YOUR_81_CHAR_PUZZLE_STRING"You can run the Sudoku Explainer app in a container without installing system dependencies on your host.
docker build -t sudoku-explainer .docker run --rm -p 8000:8000 sudoku-explainerThen open http://127.0.0.1:8000 in your browser.
To run the CLI solver inside the container:
docker run --rm sudoku-explainer python main.py --puzzle "YOUR_81_CHAR_PUZZLE_STRING"To see live logs and errors directly in your terminal, run:
docker run --rm -it -p 8000:8000 sudoku-explainerThis will show all output from the app in real time. If you want to see logs for a running container, you can also use:
docker logs -f <container_id>But with --rm and -it, you will see logs as they happen.
ruff check .
ruff format .