M2M Day 347: My four-step plan for building a human-executable chess algorithm

Max Deutsch
3 min readOct 14, 2017

--

This post is part of Month to Master, a 12-month accelerated learning project. For October, my goal is to defeat world champion Magnus Carlsen at a game of chess.

Yesterday, after a failed attempt to recruit some help, I realized that I need to proceed on my own. In particular, I need to figure out how to actually produce my (currently) mythical, only theoretical evaluation algorithm via some sort of computer wizardry.

Well, actually, it’s not wizardry — it just seems that way because I haven’t formalized a tangible approach yet. So, let’s do that in this post.

There are four steps to creating the ultimate Max Chess algorithm:

Step 1: Creating the dataset

In order to train a deep learning model (i.e. have my computer generate an evaluation algorithm), I need a large dataset from which my computer can learn. Specifically, this dataset needs to contain pairs of bitboard representations of chess positions as inputs and the numerical evaluations that correspond to these positions as outputs.

In other words, the dataset contains both the inputs and the outputs, and I’m asking my computer to best approximate the function that maps these inputs to outputs.

There seems to be plenty of chess games online that I can download, including 2,600 games that Magnus has played on the record.

The challenge for this part of the process will be A. Converting the data into my modified bitboard representation (so the data maps one-to-one with my mental process) and B. Generating evaluations for each of the bitboard representations using the open-source chess engine Stockfish (which has a chess rating of around 3100).

Step 2: Creating the model

The next step is to create the deep learning model. Basically, this is the framework for the algorithm to built around.

The model is meant to describe the form that a function (between inputs and outputs in the dataset) should take. However, before training the model, the specifics of the function are unknown. The model simply lays out the functional form.

Theoretical, this model shouldn’t have to deviate too far from already well-studied deep learning models.

I should be able to implement the model in Tensorflow (Google’s library for machine learning) without too much difficulty.

Step 3: Training the model on the dataset

Once the model is built, I need to feed it the entire dataset and let my computer go to work trying to generate the algorithm. This algorithm will map inputs to outputs within the framework of the model, and will be tuned with the algorithm parameters that I’ll need to memorize.

The actual training process should be fairly hands off. The hard part is usually getting the model and the dataset to play nicely with each other, which is honestly where I spent 70% of time during May’s self-driving car challenge.

Step 4: Testing the model and iterating

Once the algorithm is generated, I should test to see at what level it can play chess.

If the algorithm plays at a level far above Magnus, I can simplify and retrain my model, creating a more easily learned and executed evaluation algorithm.

If the algorithm plays at a level below Magnus, I’ll need to create a more sophisticated model, within the limits of what I’ll be able to learn and execute as a human.

During this step, I’ll finally find out if Max Chess has any merit whatsoever.

Now that I have a clear plan laid out, I’ll get started on Step 1 tomorrow.

Read the next post. Read the previous post.

Max Deutsch is an obsessive learner, product builder, and guinea pig for Month to Master.

If you want to follow along with Max’s year-long accelerated learning project, make sure to follow this Medium account.

--

--