Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.51 KB

File metadata and controls

46 lines (33 loc) · 1.51 KB

Tango Game AI Bot

This repository contains an AI bot developed in Python to automatically solve the Tango game available on LinkedIn.

How It Works

  • Board Reading: Uses pyautogui to 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.

Example

Below an example of how the Bot works in a real Tango game.

example.mp4

Repository Structure

  • 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.

Requirements

  • Python 3.8+
  • PyTorch
  • torchvision
  • pyautogui
  • numpy
  • pandas
  • Gurobi (with license)

Usage

  1. Train the Model:
    Run train.py to train the CNN on your labeled data.

  2. Run the Bot:
    Execute the main bot script to read the board, predict edges, solve the MILP, and play the game.