Giter Site home page Giter Site logo

beating-the-chrome-dinosaur-game's Introduction

Beating the Google Chrome Dinosaur Game

Script 1: play.py

This Python script utilizes the OpenCV, NumPy, and PyAutoGUI libraries to capture a region of the screen, count the number of black and white pixels in that region, and perform keyboard actions based on pixel count thresholds. It is primarily designed to automate actions in response to changes in the screen's pixel content.

  1. The script will continuously capture a region of the screen defined by its coordinates (left, top, width, and height) and analyze the pixel content within that region.

  2. It counts the number of black and white pixels in the captured image.

  3. Based on the pixel count thresholds, it presses the 'up' arrow key using PyAutoGUI to simulate a keyboard action.

  4. The captured region and pixel counts are displayed in a window using OpenCV.

  5. To exit the script, press the 'q' key when the OpenCV window is in focus.

Dependencies

  • OpenCV
  • NumPy
  • PyAutoGUI

Script 2: play_v2.py

  1. This Python script is designed to automate playing the popular T-Rex (Dino) game in a web browser. It uses screen capture, pixel analysis, and keyboard simulation to control the T-Rex character and help it jump over obstacles.

  2. Open a web browser and navigate to the T-Rex (Dino) game. Make sure the game is loaded and ready to play.

  3. Once the game is running, press 'Q' at any time to exit the script.

  4. The script will continuously capture a region of the screen (defined by the top, left, width, and height variables) and analyze the pixel content within that region to detect obstacles.

  5. It will simulate pressing the space bar (' ') to make the T-Rex jump when an obstacle is detected. The script also simulates the acceleration of the T-Rex by increasing the search width over time.

  6. The x_start, x_end, and y_search_cactus variables control the region where the script searches for obstacles. You can customize these values to match the game's layout and speed.

Dependencies

  • PyAutoGUI
  • Keyboard
  • OpenCV
  • NumPy

High Score using Bot

P.S. Try fiddling with the screen resolutions for best results.

References:

beating-the-chrome-dinosaur-game's People

Contributors

anuragbambardekar avatar

Stargazers

Swapnil Verlekar avatar  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.