A classic Snake game built with Python's Turtle graphics module.
The game features a black screen with a white snake, red food, and a scoreboard that tracks your current score and all-time high score.
- Press SPACE to start the game
- Use W / A / S / D to move the snake (Up / Left / Down / Right)
- Eat the red food to grow and increase your score
- Avoid hitting the walls or your own tail
- When you die, press SPACE to play again
Snakegame/
├── main.py # Main game loop, screen setup, start/end menus
├── snake_class.py # Snake movement, growth, and reset logic
├── food.py # Food placement and randomization
├── scoreboard.py # Score display and high score tracking
├── highscore.txt # Stores the all-time high score (auto-updated)
└── README.md # This file
- Python 3.x
- No extra libraries needed — uses only the built-in
turtlemodule
- Make sure Python 3 is installed on your machine
- Clone or download this repository
- Open a terminal in the project folder
- Run:
python main.pyOn some systems you may need to use
python3instead ofpython
The high score is saved automatically in highscore.txt. It persists between sessions. If you want to reset it, open highscore.txt and change the number back to 0.
This project is open source and free to use.