Bot-vinnik, a chess playing robot
I play too much chess. I took up the game about a year ago and have been studying and playing frequently since, exclusively online. I'd like to get used to playing on a real board, but finding a partner is tough. In a moment of maximum introversion, I decided to build a robotic opponent instead of making friends. The tentative project name is Bot-vinnik, in honor of the only former world champion with an easy-to-pun name.
Playing chess is a neat application for robotics, and while it might seem complicated, the project breaks down nicely into four not-so-crazy modules:
This arm is likely to be the most difficult component of the project. Luckily, the functional requirements of this module are considerably easier than most robotics applications. The workspace isn't huge, the only motion needed is translation, and the pieces are relatively large, light, and spaced apart from each other.
This module will be a bit of a foray into the unknown for me. The basic idea is to fix a webcam on a retort stand or some other elevated position, and use it to determine the state of the board. My intention is to use OpenCV for my processing needs. A chess board has nice crisp lines and contrasting colors that should make registering the board position/orientation a breeze. What isn't clear is whether I'll be able to correctly differentiate between the different types of pieces. Even if that isn't possible, I should be able to work around it by comparing the state of the board to the state of the board on the previous move - what square that was occupied is now empty, what square that was empty (or filled with a piece of another color) is now occupied.
Chess is a game full of peculiarities that make this task harder than it would initially appear. The state of the game isn't determined entirely by the position on the board. The act of castling, capturing en passant, and drawing by repetition and the 50 move rule all depend on knowledge of the previous moves of the game, so I'll have to put some thought into how this gets recorded as the game gets played out.
A chess engine is a piece of software that takes in a game state (called a position in chess), evaluates it, and produces a suggestion for what it thinks is the best move. If I were creating something from scratch, this would be a monstrous component of the project. Luckily, the best chess on the planet is currently played by an open source engine called Stockfish. Lucky! I've used Stockfish inside other applications before, but I've never had to interact with the code itself. If I can get an interface up and running for communicating with it, this module should be easy.
Like most good mechatronic projects, Bot-vinnik needs a brain to tie all the pieces together into something functional. In this case I'll have two computers running: a laptop taking care of the image processing and chess engine, and a microcontroller sending commands to the actuators on the robot arm.