A classic Snake Game built with Python and the built-in Turtle graphics library.
This project was created as a practical exercise to learn and apply Object-Oriented Programming (OOP) concepts in Python.
- Classic Snake gameplay
- Keyboard controls
- Food spawning at random positions
- Score system
- Snake grows after eating food
- Wall collision detection
- Self-collision detection
- Game Over screen
- Object-Oriented design
| Key | Action |
|---|---|
| ⬆️ Up Arrow | Move Up |
| ⬇️ Down Arrow | Move Down |
| ⬅️ Left Arrow | Move Left |
| ➡️ Right Arrow | Move Right |
python-snake-game/
│
├── main.py
├── snake.py
├── food.py
├── scoreboard.py
└── README.md
Handles everything related to the snake:
- Creating the snake
- Moving the snake
- Changing direction
- Growing the snake
Handles the food:
- Creating the food
- Randomizing its position
Handles:
- Score tracking
- Updating the score
- Game Over message
Controls the main game loop and connects all the components together.
This project helped me practice:
- Classes & Objects
- Inheritance
super()- Methods & Attributes
- Encapsulation
- Composition
- Lists
- Loops
- Conditional statements
- Randomization
- Event handling
- Game loops
- Python 3
- Turtle
No external libraries are required.
Clone the repository:
git clone https://github.com/Ramtinexe/python-snake-game.gitNavigate to the project:
cd python-snake-gameRun the game:
python main.pyA simple implementation of the classic Snake game using Python's Turtle graphics.
This project is part of my journey learning Python programming and Object-Oriented Programming through hands-on projects.
⭐ If you found this project useful, feel free to star the repository!