Late-Night Coding: Update About My Latest Chess Project
I have spent a lot of evenings the last week trying to learn and understand the logic behind coding with the help of GPT-4. Last week I made the machine print out opening data up until the first new move for the user via the Lichess API. This week I have done the following:
Made the script able to send an email with the analysis to the user. It was a bit of a challenge to figure out. I had to sign up for a service that again could connect to a website that I own webmail which has enabled me to send emails in large amounts. I can now send up to 12,000 emails a month for free with 1$ per 1,000 emails if I go over this limit. I have also made a user database that can track if the user has played a new game, which again can tricker the analysis of a game to start.
I have figured out how to generate diagram images. This was actually not that easy. Python has two packages (Python chess and CairoSVG) that you can combine to generate diagrams, in theory, since I couldn’t install the packages properly. Instead, I got the idea to make a diagram using fonts. So I downloaded the chess font Cases.
The first try looked like this:
Then I tried to add colors:
I couldn’t figure out how to make the White pieces White, so decided to go with a classic newspaper look:
With the diagram generator in place, I now had to get the email layout working. It was really a challenge to include the diagrams! And I later discovered that the different email clients do show the layout differently.
I partly succeeded in getting the images into the right position in Outlook, but on Gmail I have not figured it out. Therefore I have decided to save the analysis in an html-format. I then can host this as a link that I can email the user or maybe make a web app (not sure how difficult that is).
Here you can see how the analysis looks now from one of my games. I have played a lot of bullet games in order to quickly test if it was working.
I have sacrificed some sleep the last week since it has been quite addicting to create something and see that it is possible to get it to work!
So what should I add next? I have some ideas, but I would like to get your input.
/Martin