Skip to content

Ridiculously over-designed whack-a-potato bot for FAPI with intelligent detection, performance tracking, and visual coordinate setup.

Notifications You must be signed in to change notification settings

jakedev796/whack-a-potato-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŽฎ Whack-A-Potato Bot

Ridiculously over-designed whack-a-potato bot for FAPI with intelligent detection, performance tracking, and visual coordinate setup.

๐Ÿ’– Love this tool? Go support the amazing game that inspired it!
๐ŸŽฎ Farmer Against Potatoes Idle on Steam - Free to play!

๐Ÿ“‹ Requirements

  • Python 3.7+ (required to run the bot)
  • Windows/Linux/macOS compatible (Only tested on Windows)

โœจ Features

  • ๐ŸŽฏ Smart Detection: Precise brown/golden potato targeting with dual game state monitoring
  • ๐Ÿ–ฑ๏ธ Visual Setup: Drag-and-drop coordinate configuration with only 3 key positions needed
  • โšก Performance Tracking: Real-time statistics and session reports
  • ๐Ÿ›‘ Emergency Stop: Press ESC anytime to stop the bot
  • ๐Ÿ“Š Visual Verification: See exactly where the bot will click and monitor
  • ๐Ÿ”„ Auto Game Cycling: Intelligent game state detection with failsafe backup

๐Ÿ“ฆ Installation

1. Install Dependencies

pip install -r requirements.txt

Required packages:

  • pyautogui - Screenshots and mouse automation
  • pynput - Keyboard monitoring for emergency stop
  • Pillow - Image processing for visualizations

2. Verify Installation

All other dependencies (tkinter, json, subprocess, etc.) are included with Python.

๐Ÿš€ Quick Start

Method 1: Use the Easy Launcher (Recommended)

python setup_coordinates.py

This shows a menu with all options:

  • โœ… Visual coordinate setup (drag & drop)
  • โœ… Run the bot
  • โœ… Test coordinates
  • โœ… All utilities

Method 2: Direct Setup

  1. Set up coordinates:

    python visual_coord_grabber.py
    • Drag shapes over your game elements
    • Press SPACEBAR to save coordinates
    • Auto-launches visualizer for confirmation
  2. Run the bot:

    python whack.py
    • Press ESC anytime to emergency stop

๐Ÿ“ Files Overview

File Purpose
requirements.txt ๐Ÿ“ฆ Dependencies to install
setup_coordinates.py ๐ŸŽฎ Easy launcher menu
visual_coord_grabber.py ๐Ÿ–ฑ๏ธ Drag-and-drop coordinate setup
whack.py ๐Ÿค– Main automation bot
coordinate_visualizer.py ๐Ÿ“Š Visual coordinate verification
coordinates.json ๐Ÿ’พ Your saved coordinates
exampleSetup.jpg ๐Ÿ“ธ Example coordinate setup

๐ŸŽฏ Setup Process

Visual Coordinate Grabber (Easiest!)

  1. โš ๏ธ IMPORTANT: Play the game to an endgame screen once first! You need to see the endgame to position the red crosshair correctly.
  2. Run python visual_coord_grabber.py
  3. If coordinates exist: Shapes load at current positions for fine-tuning
  4. If no coordinates: Shapes appear at default positions
  5. Drag the cyan rectangle over your game area
  6. Position only 3 key toilets:
    • TOP LEFT toilet (reference point)
    • RIGHT OF TOP LEFT toilet (horizontal spacing)
    • BELOW TOP LEFT toilet (vertical spacing)
  7. Drag the blue crosshair to monitor when game is available
  8. Drag the red crosshair to monitor when game ends (requires endgame screen visible)
    • ๐Ÿ’ก Recommended: Position over the white 'C' in the Combo meter - it turns red when game ends
  9. Drag the yellow button over the START button
  10. Press SPACEBAR to save and verify

Example Setup Example of proper coordinate setup with all elements positioned correctly

โœจ Smart Loading: Automatically loads your existing coordinates for easy adjustments!

What Each Element Does:

  • ๐Ÿ”ต Cyan Rectangle: Game area boundary
  • ๐ŸŸข Green Circles: Key toilet positions (only 3 needed for full grid calculation)
  • ๐Ÿ”ต Blue Crosshair: Pixel monitored to detect when game is available to start
  • ๐Ÿ”ด Red Crosshair: Pixel monitored to detect when game ends
  • ๐ŸŸก Yellow Rectangle: START button location

๐ŸŽฎ Bot Usage

Starting the Bot

python whack.py

Game Flow

  1. ๐Ÿ” Bot monitors game available detection pixel (blue crosshair)
  2. ๐ŸŽฎ Clicks START button when game becomes available
  3. ๐ŸŽฏ Scans for brown/golden potatoes at 60 FPS across entire 3x5 grid
  4. ๐Ÿ’ฅ Clicks immediately when potato detected
  5. ๐Ÿ Dual End Detection:
    • Primary: Monitors game over pixel (red crosshair)
    • Failsafe: 15 seconds of no activity (backup detection)
  6. โณ Waits 4 minutes for cooldown
  7. ๐Ÿ”„ Repeats automatically

Performance Stats

The bot tracks and reports:

  • โœ… Games played
  • ๐Ÿ’ฅ Total clicks
  • โฑ๏ธ Average clicks per game
  • โšก Clicks per second
  • ๐Ÿ“ˆ Games per hour

Emergency Stop

  • Press ESC anytime to immediately stop the bot
  • Works even during cooldown periods

๐Ÿ› ๏ธ Troubleshooting

Wrong Coordinates?

  1. Run the visualizer: python coordinate_visualizer.py
  2. If positions look wrong, re-run: python visual_coord_grabber.py

Bot Not Clicking?

  1. Check if potatoes are brown/golden colored
  2. Verify toilet positions with visualizer

Game Not Starting?

  1. Check game available detection position with visualizer (blue crosshair)
  2. Verify the detection pixel changes color when game is ready
  3. Re-position blue crosshair over the correct detection area

Game Not Ending Properly?

  1. Play to an endgame screen first to see what pixel changes when game ends
  2. ๐Ÿ’ก Recommended: Position red crosshair over the white 'C' in the Combo meter (turns red when game ends)
  3. Check game over detection position with visualizer (red crosshair)
  4. Verify the pixel changes from white to red when game ends
  5. Re-position red crosshair over the correct area
  6. Failsafe will still trigger after 15 seconds if pixel detection fails

Coordinates File Missing?

  • The bot will use default coordinates if coordinates.json is missing
  • Run coordinate setup to create your custom configuration

Installation Issues?

  1. Python not found: Ensure Python 3.7+ is installed
  2. pip not found: Try python -m pip install -r requirements.txt
  3. Permission errors: Try pip install --user -r requirements.txt
  4. pyautogui issues on Linux: May need sudo apt-get install python3-tk python3-dev

๐Ÿ”ง Advanced Usage

Visual Coordinate Verification

python coordinate_visualizer.py

See exactly where the bot will click with visual overlay.

๐Ÿ“Š Configuration

Coordinates are stored in coordinates.json:

{
  "sceneScreenshotCornerX": 1735,
  "sceneScreenshotCornerY": 279,
  "sceneScreenshotWidth": 872,
  "sceneScreenshotHeight": 855,
  "leftBorderToToilet": 84,
  "topBorderToToilet": 180,
  "toiletToToiletX": 178,
  "toiletToToiletY": 290,
  "gameAvailableDetectionX": 2455,
  "gameAvailableDetectionY": 122,
  "gameOverDetectionX": 2555,
  "gameOverDetectionY": 222,
  "startButtonX": 2146,
  "startButtonY": 1325,
  "gameFPS": 60,
  "gameplaySeconds": 60
}

๐Ÿ›ก๏ธ Safety Features

  • Emergency Stop: ESC key always works
  • Failsafe Timeouts: Prevents infinite loops
  • Error Handling: Graceful recovery from issues
  • Visual Verification: See exactly what the bot will do

โš ๏ธ ToS

IMPORTANT DISCLAIMER:

  • This bot automates gameplay which may violate the game's Terms of Service
  • Use at your own risk - I'm not responsible for any account actions
  • Check the game's ToS before using automation tools
  • Consider this tool for educational/personal use only
  • The developer of this bot is not affiliated with the game developers

Ready to dominate some potatoes? ๐Ÿฅ”๐Ÿ’ช

About

Ridiculously over-designed whack-a-potato bot for FAPI with intelligent detection, performance tracking, and visual coordinate setup.

Topics

Resources

Stars

Watchers

Forks

Languages