A classic Snake Game implemented in Python using the OpenCV library with a twist.
![Screenshot 2023-08-31 113810](https://private-user-images.githubusercontent.com/109865453/264550368-92c5d0ba-a477-4cf5-afd4-fcec5b5ce5c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU2MDI4ODksIm5iZiI6MTcyNTYwMjU4OSwicGF0aCI6Ii8xMDk4NjU0NTMvMjY0NTUwMzY4LTkyYzVkMGJhLWE0NzctNGNmNS1hZmQ0LWZjZWM1YjVjZTVjNS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwOTA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDkwNlQwNjAzMDlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT05OGFkNjA5MWEyM2E1YThkYzA0YWY3YjAxYTA3OTZiNWFlYWU0NmE2MTkwYjRkZTBiNmIwYzAyMjJmZTFmY2ZlJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.JWWbfplfLCxujyHgS-sU2knH5El9xGLRUR3AMnlfBvI)
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!