Project Kasparov started out as a long-running desire to work on a chess related application.
I found the Algorithms, Typography and Literature surrounding Chess fascinating. I am not very good at playing chess though. I was stuck with the failure of deploying canvasbot, My Genetic Algorithm Art bot at this time.
I decided to create a PGN to MP4 converter. PGN or Portable Game Notation is the standard file format for recording chess matches/games. A sample looks like so:
I needed a way to parse these PGN files to something I can work with. Fortunately, I found this excellent PGN parser by Renato de Pontes Pereira. Also, I didn’t need to use Images/Vectors for rendering Chess board and pieces. Instead, I used CHEQ_TT.TTF, the Awesome Chess font. I could create cool Images like this!
The PGN Parser output a series of roughly something like this
This is called a FEN or Forsyth–Edwards Notation. The purpose of FEN is to provide all the necessary information to restart a game from a particular position.
A FEN is easily parsable. I Just needed to convert FEN to whatever glyph CHEQ_TT.TTF used. By trial and error, I created a mapping. An image of the current board position was rendered using PIL
Using some FFMPEG magic, I was able to create an MP4 file.
I still found these videos illegible, as it’s hard to keep track of the last move. So, As seen in the final version of @chssbot each move is actually 3 frames (look carefully).
- Highlight the “from” cell and “to” cell of the next move in color.
- The actual move + Highlights.
- No Highlights.
these three frames were played back at 3 X framerate. I found that the legibility of moves increased so much.
The highlighted color is randomly generated to avoid boredom 😊@chssbot has been publishing a new game every 4h from Nov 2016.
EDIT: As of 2018 June 27, @chssbot has 76 followers, and enjoys regular retweets and discussions :)
Kasparov◻ vs Gueye◼
Cannes Simultaneous Exhibition(1988)
— Chess Bot (@chssbot) June 27, 2018</blockquote>