Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Python Snake Game

A classic Snake Game built with Python and the built-in Turtle graphics library.

This project was created as a practical exercise to learn and apply Object-Oriented Programming (OOP) concepts in Python.

🎮 Features

  • Classic Snake gameplay
  • Keyboard controls
  • Food spawning at random positions
  • Score system
  • Snake grows after eating food
  • Wall collision detection
  • Self-collision detection
  • Game Over screen
  • Object-Oriented design

🕹️ Controls

Key Action
⬆️ Up Arrow Move Up
⬇️ Down Arrow Move Down
⬅️ Left Arrow Move Left
➡️ Right Arrow Move Right

🧱 Project Structure

python-snake-game/
│
├── main.py
├── snake.py
├── food.py
├── scoreboard.py
└── README.md

snake.py

Handles everything related to the snake:

  • Creating the snake
  • Moving the snake
  • Changing direction
  • Growing the snake

food.py

Handles the food:

  • Creating the food
  • Randomizing its position

scoreboard.py

Handles:

  • Score tracking
  • Updating the score
  • Game Over message

main.py

Controls the main game loop and connects all the components together.

🧠 Concepts Practiced

This project helped me practice:

  • Classes & Objects
  • Inheritance
  • super()
  • Methods & Attributes
  • Encapsulation
  • Composition
  • Lists
  • Loops
  • Conditional statements
  • Randomization
  • Event handling
  • Game loops

🛠️ Technologies

  • Python 3
  • Turtle

No external libraries are required.

🚀 How to Run

Clone the repository:

git clone https://github.com/Ramtinexe/python-snake-game.git

Navigate to the project:

cd python-snake-game

Run the game:

python main.py

📸 Gameplay

A simple implementation of the classic Snake game using Python's Turtle graphics.

📚 Purpose

This project is part of my journey learning Python programming and Object-Oriented Programming through hands-on projects.


⭐ If you found this project useful, feel free to star the repository!

About

A classic Snake Game built with Python and the built-in Turtle graphics library.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages