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