Skip to content

fenicXs/Snake-Game-using-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Snake-Game-using-Python

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.

Features:

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

How to Play:

  1. Clone the repository to your local machine.
  2. Run main.py to start the game.
  3. Use the arrow keys to control the snake's direction.
  4. Eat food to increase your score and snake's length.
  5. Avoid collisions with the walls and the snake's own body.
  6. The game ends when the snake runs into a wall or itself.
  7. Your highest score is saved in data.txt and will be displayed in future game sessions.
  8. Feel free to explore, fork, and modify the game as you like. Enjoy!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages