Skip to content

Yusufolosun/snake-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game (Python Turtle Edition)

A classic Snake game built with Python Turtle graphics, featuring real-time movement, food generation, collision detection, and persistent high-score tracking.


📌 Features

  • 🎮 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

📁 Project Structure

├── 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))

About

Snake game built with python turtle module

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages