An automated bot that plays Piano Tiles (or similar black-tile clicking games) by detecting black tiles inside a selected game window region and clicking them in real time.
- Select your game window region manually by clicking the 4 corners of the screen area.
- Automatically detects black tiles inside the region and clicks them.
- Works at high speed (no artificial delays).
- Supports safe exit with
Qkey. - Clean separation of modules:
coordinates.pyβ Selects & saves region coordinates.bot.pyβ Loads saved region and runs the bot.
Make sure you have Python installed (>=3.7).
Install dependencies:
pip install pyautogui pillow keyboardRun the following to select your game window region:
python coordinates.py-
The program will wait for 4 mouse clicks:
- Top-left corner
- Top-right corner
- Bottom-right corner
- Bottom-left corner
-
After 4 clicks, it will save the rectangle coordinates in
coords.txt.
Example coords.txt:
392,171,698,694
Start the bot with:
python bot.py- The bot will load the saved region.
- It will divide the area into 4 columns.
- Continuously scans the bottom area of each column.
- If a black tile is found, the bot clicks it.
Stop anytime by pressing Q.
bot.pyloads the region fromcoords.txt.- Captures the region using Pillow (ImageGrab).
- Divides the region into 4 columns.
- Scans each column bottom β upward for black pixels.
- If detected (
r,g,b < 50), simulates a mouse click usingpyautogui.
π piano-tiles-bot
β£ π coordinates.py # Save game window coordinates
β£ π bot.py # Main bot logic
β£ π coords.txt # Saved coordinates (auto-generated)
β£ π README.md # Documentation
- Works best when the game window is clearly visible (not obstructed).
- Accuracy depends on contrast (dark tiles vs background).
- May require tuning the black detection threshold (
r,g,b < 50) if your game looks different.
- The bot clicks inside the selected region only.
- Press Q anytime to stop safely.
β
Game region loaded: (392,171,698,694)
π€ Bot running... Press Q to stop
This project is for educational purposes only.
Use responsibly and at your own risk.