/opencv-chess-bot

Chess bot to play on whatever website using Python, OpenCV & PyAutoGUI

Primary LanguagePython

OpenCV Chess Bot

a proof of concept implementation of visual chessboard recognition
and automated move making on the screen using Python, OpenCV and PyAutoGUI

Demo video

IMAGE ALT TEXT HERE

How it works

  1. Makes a board screenshot
  2. Detects chess pieces and stores it's coordinates
  3. Generates FEN string based on piece coordinates
  4. Passes FEN to the UCI engine
  5. Converts best move to square coordinates on screen
  6. Moves a mouse to coordinates associated with the source square then mimics a click,
    moves a mouse to coordinates associated with the target square then mimics a click
  7. Repeats until the game is over

Disclaimer

Because of a cheating being a big issue nowadays
I didn't put any effort to adapt this project to be
easily used out of the box by end users, e.g. chess cheaters.
This project is intended for programmers with a tinkering purposes in mind.
Before asking any questions or opening issues make sure to follow
the tutorials below - they are short and full of the timestamps
so you can watch only those parts you're interested in

How to use it - YouTube tutorials

IMAGE ALT TEXT HERE