This is a Python program that solves Sudoku puzzles automatically using a backtracking algorithm and provides a graphical user interface (GUI) using the Pygame library.
To run this program, you need the following:
- Python 3.x: The programming language used to develop the solver.
- Pygame: The library used to create the GUI.
- Sudoku Puzzle: You can provide the Sudoku puzzle as a text file (9x9 grid), where empty cells are represented by zeros (0).
- Clone or download the repository to your local machine.
- Install Python 3.x from the official Python website if you haven't already.
- Install the Pygame library by running the following command in your terminal or command prompt:
pip install pygame
- Open the terminal or command prompt and navigate to the directory where you cloned or downloaded the repository.
- Run the following command to start the Sudoku solver:
python main.py
- The Pygame window will open, displaying an empty Sudoku grid.
- To input your Sudoku puzzle, click on a cell and type the number using your keyboard. Press Enter or Return to confirm the input.
- Once you have entered all the known numbers, press the Spacebar to start the solving process.
- The program will automatically solve the Sudoku puzzle and display the solution on the GUI.
- You can press the Spacebar again to clear the board and enter a new puzzle.
- The program uses a backtracking algorithm to solve the Sudoku puzzle. It starts by finding an empty cell in the grid and tries different numbers from 1 to 9 in that cell.
- If a number is valid, it moves on to the next empty cell and repeats the process. If a number is not valid, it backtracks and tries the next number.
- This process continues until a solution is found or all possibilities are exhausted.
- The program updates the GUI in real-time, showing the progress and the final solution.
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
This program was developed using the knowledge and techniques learned from various Python tutorials and resources. Special thanks to the Pygame community for creating a powerful library for building interactive applications.