This project is a Sudoku game built using Python and Pygame, with a graphical user interface. The game generates new Sudoku puzzles every time you play and includes features such as cell highlighting, input validation, and a home screen.
- Generates new Sudoku puzzles each time you play.
- Validates user inputs according to Sudoku rules.
- Highlights selected cells and provides visual feedback for correct and incorrect inputs.
- Home screen with options to start a new game or exit.
- Pause and resume the game using the Esc key.
To run this project locally, follow these steps:
-
Clone the repository:
git clone https://github.com/anurag265/sudoku_game.git cd sudoku_game
-
Create a virtual environment:
python -m venv venv
-
Activate the virtual environment:
- On Windows:
venv\Scripts�ctivate
- On macOS and Linux:
source venv/bin/activate
- On Windows:
-
Install the required dependencies:
pip install -r requirements.txt
-
Run the game:
python game.py
- Play Game: From the home screen, click "Play Game" to start a new Sudoku puzzle.
- Quit Game: Press the
Esc
key during the game to pause and return to the home screen or quit the game.
If you just want to play the game without setting up a development environment, follow these steps:
- Download the ZIP file from the
dist
folder. - Unzip the downloaded file.
- Open the unzipped folder.
- Double-click on
SudokuGame.exe
to start playing the game.
sudoku_game/
├── assets/
│ ├── BebasNeue-Regular.ttf
│ ├── home_screen_image.png
│ └── icon.png
├── cell.py
├── events.py
├── game.py
├── home_screen.py
├── sudoku_generator.py
├── utils.py
└── README.md
- assets/: Contains images, fonts, and icons used in the game.
- cell.py: Defines the Cell class representing each cell in the Sudoku grid.
- events.py: Handles event processing, including mouse clicks and key presses.
- game.py: Entry point for the game. Initializes and runs the main game loop.
- home_screen.py: Handles the home screen with the Play Game and Exit options.
- sudoku_generator.py: Generates new Sudoku puzzles and initializes the grid.
- utils.py: Contains utility functions for drawing the grid and cells.
Contributions are welcome! If you would like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.