This repository contains an AI bot developed in Python to automatically solve the Tango game available on LinkedIn.
- Board Reading: Uses
pyautoguito capture the game board. - Edge Prediction: Applies a trained CNN to detect "equals" and "crosses" on the board edges.
- Sun & Moon Detection: Identifies initial sun and moon positions by checking the color of certain pixels in the miniboxes.
- Optimization: Formulates the board state as a MILP problem and solves it using Gurobi.
- Automation: Automatically clicks the solution on the board.
Below an example of how the Bot works in a real Tango game.
example.mp4
mouse_info.py– Utilities to select the board pixels for pyautogui.data_loader.py– Dataset and preprocessing utilities.model.py– CNN model architecture.train.py– Model training script.cnn.pth– Pytorch trained model.screenreader.py– Board reading and prediction logic.main.py– MILP model and clicking automation.tango_solver.py– Deprecated attempt using html information.
- Python 3.8+
- PyTorch
- torchvision
- pyautogui
- numpy
- pandas
- Gurobi (with license)
-
Train the Model:
Runtrain.pyto train the CNN on your labeled data. -
Run the Bot:
Execute the main bot script to read the board, predict edges, solve the MILP, and play the game.