A classic Snake Game implemented in Python using the OpenCV library with a twist.
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.
- 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.
See the Snake Game in action:
-
Clone the repository:
git clone https://github.com/yourusername/snake-game.git cd snake-game
-
Install the required dependencies:
pip install opencv-python imutils numpy
-
Run the game:
python snake_game.py
- 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!
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.
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!