This project is a Sudoku solver implemented in Python using the Pygame library for the graphical user interface (GUI). The purpose of the code is to provide a visual representation of a Sudoku grid and allow users to interactively solve Sudoku puzzles or let the solver automatically find the solution.
To run the code on your computer, follow these steps:
Python: Make sure you have Python installed on your computer. You can download and install Python from the official Python website (https://www.python.org).
Pygame: The code relies on the Pygame library for the GUI. You can install it by running the following command in your terminal or command prompt:
pip install pygame
Copy the provided code and save it in a file named GUI.py on your computer.
Open a terminal or command prompt. Navigate to the directory where you saved the GUI.py file. Run the code using the following command:
python GUI.py
Once the code is running, a Sudoku grid will appear on the screen. You can use the keyboard to enter numbers into the grid. Press the corresponding number keys (1-9) to input a value into the selected cell. Use the arrow keys to navigate through the grid and select different cells. Press the DELETE key to clear the selected cell. Press the SPACE key to let the solver automatically solve the Sudoku puzzle. Press the ENTER key to place the value in the selected cell and check if it's correct. If the solution is correct, "Success" will be printed to the console. Otherwise, "Wrong" will be printed, and strikes will be recorded. The time taken to solve the puzzle will be displayed on the screen. If all cells are filled correctly, "Game over" will be printed to the console.
With this Sudoku solver, you can either solve Sudoku puzzles interactively or test your own puzzle-solving skills. Happy Sudoku solving!