snake_game_OpenCV

A classic Snake Game implemented in Python using the OpenCV library with a twist.

Screenshot 2023-08-31 113810

Table of Contents

Description

Welcome to the Snake Game – a Python implementation of the classic game using the OpenCV library for rendering and game mechanics. Control a hungry snake, eat apples, grow longer, and enjoy a timeless gaming experience.

Features

  • Smooth and responsive snake movement controlled by arrow keys.
  • Randomly placed apples for the snake to devour and extend its length.
  • Real-time score tracking displayed on the screen.
  • Engaging winning condition for players to strive for.
  • Colorful and dynamic visuals, powered by OpenCV.
  • No collision, so enjoy an immortal snake play.

Demo

See the Snake Game in action:

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/snake-game.git
    cd snake-game
  2. Install the required dependencies:

    pip install opencv-python imutils numpy
  3. Run the game:

    python snake_game.py

How to Play

  • Use an object with the color scheme(I have used a green bottle cap if you have any other object, change the code accordingly).
  • The snake grows in length when it consumes an apple.
  • Avoid colliding with the screen boundaries or yourself.
  • Reach the maximum score to achieve victory!

Contributing

Contributions are always welcome! If you find any bugs or have ideas for improvements, please create an issue or submit a pull request. Let's make this game even better together.

License

This project is licensed under the MIT License.

Note: This project was created for educational purposes and as a fun coding exercise. And the code was inspired by Abhishek Sharma. Enjoy!