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
How it works
- Makes a board screenshot
- Detects chess pieces and stores it's coordinates
- Generates FEN string based on piece coordinates
- Passes FEN to the UCI engine
- Converts best move to square coordinates on screen
- 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 - 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