https://github.com/saadarazzaq/sudoku-game
A GUI based Sudoku solver built with pygame 🐍🔢
https://github.com/saadarazzaq/sudoku-game
documentation gui pygame python sudoku-solver
Last synced: about 2 months ago
JSON representation
A GUI based Sudoku solver built with pygame 🐍🔢
- Host: GitHub
- URL: https://github.com/saadarazzaq/sudoku-game
- Owner: SaadARazzaq
- Created: 2024-06-16T21:13:10.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-06-16T21:17:25.000Z (11 months ago)
- Last Synced: 2025-01-23T16:14:21.378Z (3 months ago)
- Topics: documentation, gui, pygame, python, sudoku-solver
- Language: Python
- Homepage: https://www.youtube.com/watch?v=8zRXDsGydeQ
- Size: 296 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Sudoku Game
## Overview
This Python-based Sudoku game provides a graphical interface using Pygame. Users can solve the Sudoku puzzle manually or allow the computer to solve it. The interface supports selecting cells, entering numbers, and validating the solution.## Features
- Interactive GUI for playing Sudoku
- Manual entry of numbers
- Automatic solving of the Sudoku puzzle
- Highlighting of selected cells and incorrect placements## Requirements
- Python 3.x
- Pygame## Installation
1. Ensure you have Python 3.x installed on your system.
2. Install Pygame using pip:
```sh
pip install pygame
```
3. Download or clone the Sudoku script to your local machine.## How to Use
1. Open your terminal or command prompt.
2. Navigate to the directory where the script is located.
3. Run the script using Python:
```sh
python sudoku.py
```## Gameplay Instructions
- **Select a Cell:** Click on a cell to select it.
- **Enter a Number:** Use the number keys (1-9) to enter a number into the selected cell.
- **Temporary Number:** Sketch a temporary number by selecting a cell and pressing a number key.
- **Confirm Entry:** Press the Enter key to confirm the number in the selected cell.
- **Clear Cell:** Press the Delete key to clear the selected cell.
- **Solve Automatically:** Press the Spacebar to let the computer solve the Sudoku puzzle.
- **Exit:** Close the window to exit the game.## Commands
### Mouse Click
- Click on a cell to select it. The selected cell is highlighted in red.### Number Keys (1-9)
- Enter a number into the selected cell as a temporary sketch.### Enter Key
- Confirm the number in the selected cell.### Delete Key
- Clear the selected cell if it contains a temporary number.### Spacebar
- Automatically solve the Sudoku puzzle using a graphical solving method.## Game Outputs:



## Test Cases:

## Developer Notes
- The Sudoku game uses Pygame for rendering the graphical interface and handling user input.
- The `Grid` class represents the Sudoku board and contains methods for drawing, selecting, and solving the puzzle.
- The `Cube` class represents individual cells in the Sudoku grid, with methods for drawing the cell and handling temporary and permanent values.
- The `solve` and `solve_gui` methods implement the backtracking algorithm to solve the puzzle.
- The `find_empty` method uses a heuristic to find the cell with the fewest possible values for efficient solving.## Future Enhancements
- Add more Sudoku puzzles with varying difficulty levels.
- Implement a hint system to assist players.
- Add an option to highlight incorrect placements automatically.
- Improve the graphical interface with better visual feedback.---
Enjoy playing the Sudoku game! If you encounter any issues or have suggestions for improvements, feel free to contribute or open an issue.