Code Monkey home page Code Monkey logo

snake_game_opencv's Introduction

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!

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.