A classic Snake game built with Python Turtle graphics, featuring real-time movement, food generation, collision detection, and persistent high-score tracking.
- ๐ฎ Smooth keyboard controls (Arrow Keys)
- ๐ Random food spawning
- ๐ Score & high-score system (persistent storage)
- ๐ฅ Collision detection:
- Wall boundaries
- Snake tail
- ๐ Automatic reset after game over
- ๐จ Minimalistic UI with Turtle graphics
Controls: โฌ๏ธ Up Arrow โ Move Up โฌ๏ธ Down Arrow โ Move Down โฌ ๏ธ Left Arrow โ Move Left โก๏ธ Right Arrow โ Move Right
โโโ main.py # Game entry point
โโโ snake.py # Snake logic & movement
โโโ food.py # Food generation logic
โโโ scoreboard.py # Score tracking system
โโโ data.txt # High score storage
โโโ README.md # Documentation
โโโ .gitignore # Ignored files list
๐ฏ How It Works
Game Logic Overview
The snake moves continuously forward
Player changes direction using arrow keys
Eating food:
Increases length
Increases score
Collision causes:
Score reset
Snake reset
High-score saved
๐ง Key Concepts Used
Object-Oriented Programming (OOP)
Event listeners (screen.onkey)
Game loop (while)
Collision detection
File I/O for persistent data
Turtle animation optimization (screen.tracer(0))