M2M Day 344: Would most people consider this cruel and unusual punishment?

Max Deutsch
5 min readOct 11, 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.

Today, based on analysis from the past few days, I started building my chess algorithm. The hope is that I can build an algorithm that is both effective (i.e. plays at a grandmaster level), but also learnable, so that I can execute it in my brain.

As I started working, I realized very quickly that I first need to work out exactly how I plan to perform all of my mental calculations. This mental process will inform how I structure the data in my deep learning model.

Therefore, I’ve used this post as a way to think through and document exactly this process. In particular, I’m going to walk through how I plan to mentally convert any given chessboard into a numerical evaluation of the position.

The mental mechanics of my algorithm

First, I look down at the board:

Starting in the a column, I find the first piece. In this case, it’s on a1, and is a Rook. This Rook has a corresponding algorithmic parameter (i.e. a number between -1 and 1, rounded to two places after the decimal point) that I add to the running total of the first sub-calculation. Since this is the first piece on the board, the Rook’s value is added to zero.

The algorithmic parameter for the Rook can be found in my memory, using the following mental structure:

In my memory, I have eight mind palaces that correspond to each of the lettered columns from a to h. A mind palace, as explained during November’s card memorization challenge, is a fixed, visualizable location to which I can attach memories or information. For example, one such location could be my childhood house.

In each mind palace, there are nines rooms, one corresponding to each row from 1 to 8, and an extra room to store the data associated with castling rights. For example, one such room could be my bedroom in my childhood house.

In the first eight rooms, there are six landmarks. For example, one such landmark could be the desk in my bedroom in my childhood house. In the ninth room, there are only four landmarks.

Attached to each landmark are two 2-digit numbers that represent the relevant algorithmic parameters.

The first three landmarks correspond to the White pieces and the second three landmarks correspond to the Black pieces. The first landmark (of each set of three) is used for the algorithm parameters associated with the King and Queen, the second landmark is used for the Rook and Bishop, and the third landmark is used for the Knight and Pawns.

So, when looking at the board above, I start by mentally traveling to the first mind palace (column a), to the first room (row 1), to the second landmark (for the White Rook and Bishop), and to the first 2-digit number (for the White Rook).

I take this 2-digit number and add it to the running total.

Next, I move up the column until I hit the next piece. In this case, there is a White pawn on a2. So, staying in the a mind palace, I mentally navigate to third landmark in the second room, and select the second 2-digit number, which I then add to the running total.

I next move on to the Black pawn on a6, and so on, until I’ve worked my way through the entire board. Then, I enter the ninth room, which provides the 2-digit algorithmic parameters associated with castling rights.

At this point, I take the summed total and store it in my separate 16-landmark mind palace, which holds the values for the first internal output (i.e. the values for the vector of the first hidden layer).

This completes the first pass of the chessboard, outputting the first of 16 values for . Thus, I still need to complete fifteen more passes, which repeat the process, but each using a completely new set of mind palaces.

In other words, I actually need 16 distinct mind universes, in which each universe has eight mind palaces of eight rooms of six landmarks and one room of four landmarks.

After completing the process 16 times, and storing each outputted value in the mind palace, I can move onto the second hidden layer, converting into by passing the values of through a matrix of 256 algorithmic parameters.

These parameters are stored in a single mind palace of 16 rooms. Each room has eight landmarks and each landmark holds two 2-digit parameters.

Unlike the conversion from the chessboard to , for the conversion of to , I almost certainly need to use all 256 parameters in row (unless I implement some kind of squashing function between and , reducing some of the values to zero… I’ll explore this option later).

Thus, I start by taking the first value of and multiplying it (via mental math cross multiplication) by the first value in the first room of the mind palace. Then, I take the second value of , multiply it to the second value in the first room, and add the result to the previous result. I continue in this way until I finish multiplying and adding all the terms in the first room, at which point I store the total as the first value of h².

I proceed with the rest of the room, until all the values of are computed.

Finally, I need to convert to a single number that represents the numerical evaluation of the given chess position.

To do this, I access one final room in the mind palace, which has eight landmarks each holding two 2-digit numbers. I multiply the first number in this mind palace with the first value of , the second number with the second value of , and so on, adding the results along the way.

In the end, I’m left with a single sum, which should closely approximate the true evaluation of the chess position.

If this number is greater than the determined threshold value, then I should play the move corresponding to this calculation. If not, then I need to start all over with a different potential move in mind.

Some notes:

  1. I still need to work out how I plan to store negative numbers in my visual memory.
  2. Currently, I’ve only created one mind universe, so, assuming I can computationally validate my algorithmic approach, I’ll need to create 15 more universes. I’ll also need to create a higher level naming scheme or mnemonic system for the universes that I can use to keep them straight in my brain.
  3. There is a potential chance that I will need more layers, fewer layers, or different sized layers in my deep learning model. In any of these cases, I’ll need to repeat or remove the procedures, as described above, accordingly.

With the details of my mental evaluation algorithm worked out, I have everything I need to been the computational part of the process.

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.

--

--