This repository contains a classic Snake game implemented in Python using the Turtle graphics library. The game includes the following features:
-
Snake Class: Represents the snake on the game board. The snake can move in four directions (up, down, left, right) and grows in length when it eats food.
-
Food Class: Represents the food that appears randomly on the game board. When the snake collides with the food, its length increases and the score updates.
-
Scoreboard Class: Tracks and displays the player's current score and the highest score achieved. The scores are stored in a data.txt file which persists between game sessions.
- Classic Snake gameplay where the player controls the snake to eat food and avoid collisions with the walls or its own body.
- Simple graphics rendered using Python's Turtle module.
- Scoreboard that keeps track of the player's current score and highest score ever achieved.
- Data persistence using a text file (data.txt) to store and update the high score.
- Clone the repository to your local machine.
- Run main.py to start the game.
- Use the arrow keys to control the snake's direction.
- Eat food to increase your score and snake's length.
- Avoid collisions with the walls and the snake's own body.
- The game ends when the snake runs into a wall or itself.
- Your highest score is saved in data.txt and will be displayed in future game sessions.
- Feel free to explore, fork, and modify the game as you like. Enjoy!