A high-performance Sudoku engine featuring an interactive game and an automated solver.
Leveraging recursive backtracking for efficient puzzle solving and a robust terminal-based interface for gameplay.
The application is architected to balance algorithmic efficiency with user interactivity. At its core, it implements a Constraint Satisfaction approach to Sudoku solving:
- Backtracking Solver: A recursive algorithm that explores the search space by placing digits and pruning branches as soon as a constraint (Row, Column, or 3x3 Box) is violated.
- Board Generation: Utilizes a randomized filling strategy followed by a cell-removal process to generate unique puzzles with varying difficulty.
- State Management: The board is maintained as a 2D matrix (list of lists) with real-time validation checks during both manual play and automated solving.
- Terminal Interface: Uses Python's standard I/O for a lightweight, dependency-free command-line experience.
SudokuApp/
├── project.py # Main orchestrator and core logic
├── test_project.py # Automated test suite using pytest
├── requirements.txt # Python dependencies manifest
├── LICENSE # MIT License terms
├── README.md # Project documentation
│
└── .git/ # Version control repository
Experience Sudoku directly in your terminal. The game mode provides:
- Puzzle Generation: Dynamic creation of 9x9 Sudoku boards.
- Real-Time Validation: Immediate feedback on invalid placements.
- Completion Check: Automated verification of the final solution.
Solve any valid 9x9 Sudoku puzzle instantly.
- Heuristic Exploration: Efficiently finds solutions using recursive depth-first search.
- Consistency Checking: Ensures the input board is valid before attempting a solution.
| Aspect | Details |
|---|---|
| Language | Python 3.8+ |
| Solving Algorithm | Recursive Backtracking (DFS) |
| Testing Framework | Pytest |
| Board Generation | Randomized Filling + Cell Removal |
Obtain a local copy of the repository:
git clone https://github.com/Zer0-Bug/SudokuApp.gitInstall the necessary dependencies to run tests and the application:
cd SudokuApppip install -r requirements.txtLaunch the interactive menu to start playing or solving:
python project.pyExecute the test suite to verify algorithm integrity:
pytest test_project.pyContributions are welcome! If you have suggestions for performance improvements or new features, feel free to contribute:
- Fork the repository.
- Create a new branch for your change:
git checkout -b feature/your-feature-name - Commit your changes with a clear and descriptive message:
git commit -m "Add: brief description of the change" - Push your branch to your fork:
git push origin feature/your-feature-name - Open a Pull Request describing the changes made.
All contributions are reviewed before being merged. Please ensure that your changes follow the existing code style and include relevant documentation or tests where applicable.
∞