SudokuApp is a robust Python-based application designed for both enthusiasts who love to play Sudoku and developers interested in algorithmic puzzle solving. It features a complete interactive game engine and a powerful backtracking-based solver capable of solving any valid 9x9 Sudoku puzzle.
- Interactive Game Mode: Play randomly generated Sudoku puzzles with real-time input validation.
- Automated Backtracking Solver: A technically sophisticated solver that finds solutions for complex puzzles using recursive backtracking.
- Dynamic Board Generation: Generates valid Sudoku boards and removes cells to create unique puzzles.
- Input Validation: Robust error handling for user inputs to ensure a seamless experience.
- Comprehensive Testing: Includes a full test suite powered by
pytestfor ensuring algorithm reliability.
The core of the solver is a recursive backtracking algorithm. It works by:
- Identifying the next empty cell on the board.
- Attempting to place digits 1 through 9.
- Checking if the placement is valid (row, column, and 3x3 subgrid checks).
- Recursively calling itself to solve the remaining board.
- Backtracking if a contradiction is found.
This approach ensures that we explore the search space efficiently while finding the correct solution if it exists.
project.py: The entry point of the application containing the game logic and solver.test_project.py: Contains automated tests for verifying key functions.requirements.txt: External dependencies required for the project.
- Python 3.8 or higher.
- Clone the repository:
git clone https://github.com/Zer0-Bug/SudokuApp.git cd SudokuApp - Install dependencies:
pip install -r requirements.txt
Start the main script to interact with the game menu:
python project.pyWe believe in code quality. The project uses pytest for unit testing the core logic.
To run the tests:
pytest test_project.py| Function | Description | Status |
|---|---|---|
fill_board |
Board generation logic | ✅ Passed |
remove_cells |
Puzzle creation complexity | ✅ Passed |
solve_sudoku |
Algorithm correctness | ✅ Passed |
Contributions are always appreciated. Open-source projects grow through collaboration, and any improvement—whether a bug fix, new feature, documentation update, or suggestion—is valuable.
To contribute, please follow the steps below:
- 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.
Distributed under the MIT License. See LICENSE for more information.
∞