DEV Community

Sergio Avalos
Sergio Avalos

Posted on

Sudoku game!

I've always enjoyed playing Sudoku—it’s a game that combines logic, numbers, and strategy in a way that’s both challenging and satisfying. When I started learning Python, I thought creating a Sudoku game would be a perfect first project. Not only would it help me practice programming concepts, but it would also result in something fun and interactive.

About the code:

This project is built using Python and the Pygame library, allowing me to create an interactive UI for the game. The code generates Sudoku puzzles dynamically, ensures they have unique solutions and also includes error validation. Players can navigate the grid, fill in numbers, and enjoy randomized background music. The code is structured into multiple classes for better organization, covering grid management, player movement, and more.

This project was a great way to combine my liking for Sudoku with my new Python skills. It’s far from perfect, but I’m proud of how it turned out. If you enjoy Sudoku or want to explore the code, feel free to check it out.

Check out the repository:

Special Thanks

  • JP
  • KUWAGO
  • Filo Starquez
  • SKIRK
  • Hotham
  • Beat Mekanik

Thanks to these artists for the amazing music that's being used as the background music for this game. Every song was found on https://soundcloud.com/royaltyfreemusic-nocopyrightmusic, thanks to RFM NCM for the amazing collection.

Compatibility

  • Linux: The included executable "Sudoku" is compatible with Linux systems. Simply run it to play the game.
  • Other Platforms: For Windows or macOS, you can run the game using Python:
  1. Install Python 3.10 or higher.
  2. Clone this repository:
    git clone https://github.com/your-username/sudoku.git
    
  3. Navigate to the project directory:
    cd sudoku
    
  4. Install dependencies:
    pip install -r requirements.txt
    
  5. Run the game:
    python main.py
    

How to play

  • Move around using the arrow keys or WASD.
  • Place your number using the keys on your keyboard.
  • Press Q to turn on or off the music.
  • Press 0 to errase any number.
  • Once you win/lose press enter to play again.
  • Enjoy!



Sudoku game

Top comments (0)