This bot retrieves game data through color matching and calculates optimal moves using multiprocessing. It's optimized for back-to-back (b2b) moves, including T-spins and other advanced spins.
-
Install dependencies:
pip install -r requirements.txt
-
Run the calibration wizard (first time setup):
python bot.py --calibrate
-
Start the bot with your saved configuration:
python bot.py --use-config
The bot includes an interactive calibration wizard that captures your screen coordinates for accurate gameplay detection. This is much easier than manually editing coordinate values!
python bot.py --calibrateThe wizard guides you through 5 steps to capture the necessary screen positions:
| Step | What to Capture | Description |
|---|---|---|
| 1 | Board Top-Left | Move mouse to the top-left corner of the Tetris board |
| 2 | Board Bottom-Right | Move mouse to the bottom-right corner of the Tetris board |
| 3 | Next Piece #1 | Move mouse to the center of the first (topmost) next piece preview |
| 4 | Next Piece #5 | Move mouse to the center of the fifth (bottommost) next piece preview |
| 5 | Held Piece | Move mouse to the center of the held piece display |
- Press
=- Capture the current mouse position - Press
Escape- Cancel calibration and exit
After successful calibration, your settings are saved to config.json. This file stores:
- Screen resolution
- Board coordinates
- Next piece positions
- Held piece position
- AI parameters (multiprocessing workers, pruning settings)
| Option | Description |
|---|---|
--calibrate |
Run the interactive calibration wizard |
--use-config |
Load settings from config.json |
--mp N |
Override multiprocessing workers (default: 4) |
--pruning-moves N |
Override pruning moves parameter |
--pruning-breadth N |
Override pruning breadth parameter |
--delay N |
Override move delay in milliseconds (default: 30) |
--action-delay N |
Override action delay in milliseconds (default: 50) |
--delay-variance N |
Override delay variance percentage (default: 20) |
# First time setup - calibrate your screen
python bot.py --calibrate
# Run bot with saved configuration
python bot.py --use-config
# Run with custom performance settings
python bot.py --use-config --mp 8
# Run with custom AI parameters
python bot.py --use-config --mp 8 --pruning-moves 3 --pruning-breadth 5
# Run with custom delay settings (more human-like)
python bot.py --use-config --delay 50 --action-delay 80 --delay-variance 30
# Run without config (uses hardcoded defaults)
python bot.pyThe bot includes configurable delays to make inputs appear more human-like, which helps avoid anti-cheat detection.
| Setting | Description | Default |
|---|---|---|
move_delay_ms |
Delay between each keypress (left/right movements) | 30ms |
action_delay_ms |
Delay after actions like hold, rotate, and hard drop | 50ms |
delay_variance_percent |
Random variance applied to delays (±%) | 20% |
The variance makes timing less predictable. For example, with a 30ms base delay and 20% variance:
- Actual delays will range from 24ms to 36ms (30ms ± 20%)
- Each delay is randomly calculated within this range
- During Calibration: The wizard prompts for delay settings in step 6
- In config.json: Manually edit the delay values
- CLI Override: Use
--delay,--action-delay, or--delay-varianceflags
{
"screen_offset": [0, 0],
"screen_resolution": [1920, 1080],
"board_top_left": [730, 82],
"board_bottom_right": [1185, 988],
"next_piece_xy_0": [1337, 192],
"next_piece_xy_4": [1337, 735],
"held_piece_xy": [615, 191],
"move_delay_ms": 30,
"action_delay_ms": 50,
"delay_variance_percent": 20
}| Use Case | move_delay_ms | action_delay_ms | variance |
|---|---|---|---|
| Maximum Speed (risky) | 10 | 20 | 10 |
| Balanced (default) | 30 | 50 | 20 |
| Safe/Human-like | 50 | 80 | 30 |
| Very Conservative | 80 | 120 | 40 |
If you prefer not to use the calibration wizard, you can still manually adjust the parameters in bot.py:
screen_resolution=(1920, 1080),
board_top_left=(787, 220),
board_bottom_right=(1133, 899),
next_piece_xy_0=(1260, 300),
next_piece_xy_4=(1260, 721),
held_piece_xy=(691, 300),For optimal bot performance, configure TETR.IO with these settings:
- ARR: 0ms
- DAS: 40ms
- SDF: max
- Mouse position not capturing: Ensure no other application is intercepting the
=key - Wrong coordinates saved: Re-run
python bot.py --calibrateto recalibrate - Config file not loading: Check that
config.jsonexists and is valid JSON
- Bot moves incorrectly: Re-calibrate to ensure accurate board detection
- Bot is slow: Increase
--mpvalue for more parallel processing - Bot misses pieces: Ensure the next piece and held piece positions are correctly calibrated
- Python 3.x
- pyautogui
- mss
- numpy
- See
requirements.txtfor full list
Use this bot at your own discretion. Using it in multiplayer mode could result in your account and IP address being banned.