There is a Steam game called Farmer Against Potatoes Idle, and it contains a game just like the old "whack-a-mole", but with potatoes!
The game is pretty straightforward, there are 2 "good" potatoes that give you points, and 2 "bad" ones that take your points. This script checks for good potatoes on your primary screen and clicks them as fast as possible.
First of all, you need python for this, so download it first. Then execute the following command to install the needed libraries:
pip install -r requirements.txtYou might need to use the terminal to run the script. Here are some links to help you, in case you are unfamiliar with the terminal.
Next configure the script to work on your screen. The script uses confidence factors, such as if the colors are similar, if the pixels are similar, but it also takes size into account! And because of this, the success of the script depends on the resolution that your game is running at, which can be anything given that the game can run in windowed mode, and you can resize the window as you see fit. The following steps will set up the script so it works with the resolution that your game is running at.
- Open the whack-a-mole screen so the potato 'toilets' are visible.
- Run the script
region_test.pyand check theimg/region_test.pngto see what region the script is scanning. Drag/resize the game window and rerun the script until all the 'toilets' are visible inregion_test.png. It doesn't matter if the game is full screen or not, both will work. - With the screen size configured, press the info button until the points per potato are visible, like in the image below.
Either in your IDE, or in a terminal, run the script script.py to start the
program, for example:
python script.pyThis will start the script and show you the keyboard shortcuts to start and stop the scanning algorithm. The scanning starts as STOPPED by default, so you just need to press the start key for it to start clicking those potatoes. And when you're not using, just press the stop key.
To actually use the script, go to the whack-a-mole game whenever the timer allows you to start a new game. Press the shortcut to start the scanning (F8 by default), and click the start button in the game. The script will automatically start clicking the potatoes as they appear. Sit back and relax while the points are coming in.
Note: there is high variability in how fast the script can click. It all depends on how successful the image search is. In any case, the accuracy should be 100%.
If you want to stop the script entirely, go into the terminal you used to start
the program and press Ctrl + C, it will shutdown the process.
The script uses PyAutoGUI to handle the image search and screen clicks. It
basically takes a screenshot of a specific region often as possible and searches
for a specific image inside that screenshot (our eye.png) taking color and other
factors into account.
But because the confidence isn't 100%, it will allow the image to be true even if some small things are different, so after some testing 0.8 is a good value because it can find normal potatoes and the special ones as well, while not clicking green or red ones.
It also uses the keyboard library to handle keyboard presses, because having
to Ctrl + C while your mouse is clicking everywhere is not a good idea...
Instead, when you press a specific key (f8 by default) it will start or stop
the script.
There are multiple images in the img folder because they might be useful incase you're doing extra automations, for example automatically starting the round when the timer reaches to 0.
