Git Product home page Git Product logo

snakegame's Introduction

Snake Game

Snake Game in Python

Overview

This is a simple implementation of the classic Snake Game using Python and Object-Oriented Programming (OOP) principles. The game is played in the console, and the snake grows longer as it consumes food, while the player aims to achieve the highest score without colliding with the game boundaries or the snake's own body.

Features

  • Object-oriented design for better code structure and readability.
  • Simple console-based user interface.
  • Snake grows in length upon consuming food.
  • Score tracking to keep track of the player's progress.

Requirements

Python 3.x

How to Play

  1. Clone the repository:
git clone https://github.com/sepidehkhakzad/SnakeGame.git
  1. Navigate to the project directory:
cd SnakeGame
  1. Run the game:
python main.py
  1. Use the arrow keys to control the snake's direction:
  • Up arrow: Move the snake up
  • Down arrow: Move the snake down
  • Left arrow: Move the snake left
  • Right arrow: Move the snake right
  1. Try to eat the food (denoted by F on the screen) to increase your score and the snake's length.

  2. The game ends if the snake collides with the screen boundaries or its own body.

Here's a demo of the game:

normal

File Structure

  • main.py: Main Python script containing the game logic and implementation.
  • snake.py: Snake object class to keep track of the length and movement of the snake.
  • food.py: Food object class to keep track of the position of the food and change it after every collision.
  • scoreboard.py: Scoreboard object class to keep track of the score and force the gameover sequence.
  • README.md: Documentation file providing information about the project.

Acknowledgments

This project was inspired by the classic Snake Game. Special thanks to the Python community for providing valuable resources and support.

Contribution

Contributions are welcome! Feel free to submit issues or pull requests to improve the game.

License

This Snake Game project is licensed under the Apache License.

Enjoy the game! ๐Ÿ๐ŸŽฎ

snakegame's People

Contributors

sepidehkhakzad avatar

Stargazers

Hamed Mohammadi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.