Skip to content

Latest commit

 

History

History
23 lines (18 loc) · 1.08 KB

README.md

File metadata and controls

23 lines (18 loc) · 1.08 KB

OpenCV test - automatic Whac-a-mole

In this little project I tried to use Python and openCV template matching to play Whac-a-mole automatically while holding the Spacebar key.

If you want to try it, you will either need Python Poetry (package manager) or manually install needed packages:

  • Python 3.11
  • keyboard
  • opencv-python-headless
  • mss
  • pyautogui

How to run with Poetry:

  1. Clone the repo
  2. Install Poetry
  3. Run poetry install from terminal while positioned in the project folder
  4. Open Whac-a-mole
  5. Screenshot the part of image that you want to recognize (the mole in this example) that is always unchanged (example comparison_image.png included) and put it in openCV_test/files as comparison_image.png
  6. Run start.bat from openCV_test/
  7. Hold Spacebar to automatically click on the mole and rack up points

Press Page Up to see debug info in terminal, Page Down to turn it off.

To stop the script, use Ctrl+C or exit the terminal.