An automation bot that plays the Piano Tiles game by detecting black tiles and clicking on them at superhuman speeds, using color detection and automated mouse controls.
The Piano Tiles Bot is an automated script designed to play the popular Piano Tiles game available on Crazy Games. The bot uses screen pixel color detection to identify the black tiles as they appear and automatically clicks on them at superhuman speeds.
The bot can be triggered with a keyboard shortcut and stopped at any time, making it easy to use and demonstrate. The project showcases how computer automation can be used to achieve perfect gameplay that would be impossible for human reflexes.
The bot is implemented in Python and uses PyAutoGUI for screen analysis and mouse control, along with the keyboard module for input handling:
import pyautogui
import keyboard
target_color = (50, 71, 70)
tolerance = 50
pixel_coordinates = [(417, 555), (492, 555), (580, 555), (656, 555)]
bot_running = [False]
keyboard.on_press_key('q', lambda _: bot_running.__setitem__(0, True))
print("Press 'q' to start the bot. Press 'esc' to stop.")
while True:
if bot_running[0]:
for coordinates in pixel_coordinates:
pixel_color = pyautogui.pixel(*coordinates)
if all(abs(pixel_color[i] - target_color[i]) <= tolerance for i in range(3)):
pyautogui.click(*coordinates)
if keyboard.is_pressed('esc'):
bot_running[0] = False
print("Stopping the bot.")
break