I set out on a quest to create something like a mechanical Turk. I wanted to teach a robot how to play chess. When I began the project I had a pretty quick deadline: the Raleigh Maker Faire. I knew I couldn't possibly build a robot and program it to play chess all before the Maker Faire, but I was confident that if I had a robot I could program it to play chess.
The Robot
Being a member of a Hackerspace comes with all sorts of benefits, of which the greatest is the network of hobbyists you'll invariably build connections to. One of the people in this network, who calls himself Inventor42, had built several 3D printer designs. He was interested in having his 2nd most recent design do something new. The 3D printer he gave me permission to use was a modification of the Rostock Delta Bot, a RepRap design which we both decided would look really cool playing chess.
I received his permission to hack the delta-bot into an electro-magnet based pick-and-place machine. The electro-magnet would be used to pick up chess pieces and move them about the board. I had to get an idea on how big I could make the chess board and still have the robot reach all the corners. This delta-bot was designed to be able to print onto an 8-inch square. The board would have to be smaller than that for me to have a place to place the pieces down after they were captured. I settled on a 7-inch square.
I received more great help from another hackerspace member who goes by the name of Schism. Schism had been playing chess regularly at the Queen City Chess Club, and already had experience printing out pieces for the set he took with him there. I passed along the dimensions of my board and he had two complete sets made in short order.
Each piece had a nail pushed through the center so that they could be picked up with the electromagnet. More shout-outs go to [Hyre] and Hsoj48 for producing an electromagnet and for preparing the pieces with the nails.
The Program
Most 3D printers are controlled using a programming language for numerical control called G-code. This same programming language can be used to control CNC routers, plotters, and it is what I decided I would use to control my chess playing robot. I knew from playing chess that most chess programs and chess players record moves using Algebraic Notation. The program would need to convert from the standard algebraic notation to G-Code so I set out to create a library that could do just that.
The Algebraic Notation to G-code converter currently requires moves to be entered as Reversible Algebraic Notation since it doesn't keep track of where the pieces are in the game. One simply enters the starting location of a piece and the ending location of the piece in order to get the robot to move the piece. The advantage of doing it this away is that it allows flexibility in whether or not the game is played by both people by entering their moves or just one person entering moves and the other moving pieces on the board directly.
In the version that was ready for Maker Faire all the pieces were the same height, which meant that the delta-bot did not have to worry about moving to a different height for each piece. The software was flexible enough to move the height of a specific piece though, since the piece is specified in reversible algebraic notation.
Future Plans
I hope to get a bit more accuracy in the robot, and to make the movements a bit less jerky. Hopefully after making the moves less jerky I should be able to make moves faster. I'd like to clean up the connections and wires on the robot itself so that it is easier to transport.
I would like to make the software keep track of a game so that standard algebraic notation may be entered without requiring any additional information. I would also like to have a visual front end for the software instead of the terminal front end I had made for Maker Faire at the last minute. The software should allow people to enter commands from devices that aren't directly attached to delta-bot. It would be nice to provide an entire game in PGN format and watch the robot play it out for demonstration purposes.
Here is the chess move to G-Code converter repository where I've uploaded the code which converts the reversible algebraic notation move into G-Code commands to be used by any 3D-Printer.
Please contact me if you would like to help with the project, or would like help getting it working for you.