What do you speak ? Chess

Anuvesh Kumar
2 min readMar 13, 2019

The domain of chess AI is massive. I’ve been working on it as my final year project. However, navigating through this field has been a arduous task. During my time, I took on few courses like NLP, Text Mining & Analytics. I realized something…

Imagine two aliens, they live in a very strange world, the world of chess, with very well defined rules. They speak a very strange script; their conversation usually goes like “1. d2-d4 d7-d5 2. c2-c4, c3-c7”

The sequences of chess and natural language shares many common features. A natural language is bound by grammatical rules, and chess is bound by chess rules. Both sequences of natural language and chess have temporal dependency. Both have a rich set of vocabulary “d2-d4, e6xd5, Ng1-f3”.

Every word in chess is a move. Now you might wonder, “a language is not just words, they are sentences, combined words that make sense”, if not, now you are. Just like you learned how to make valid sentences from old text. These aliens learn the same, by reading previous winning conversations(games).

For the output of a sentence(a full game) is valid(1), for the side who wins. So, if I’m black and speaking a set of words(moves) makes me win, then that’s the sentences I prefer. This gives us an input output, supervised learning problem.

A game sequence as inputs and the result of the game as the output. This could be modeled in a similar fashion as sentiment analysis using recurrent networks. The next challenge (similar to text generation) is move generation.

A valid move is dependent of the previous moves and can always be checked empirically. But we need to the Chess engine to give good moves. This can be modeled similar to a LSTM-recurrent network which is used to text generation for which the training set will the the sequence of moves, extracted from pgn files and filtering the ones which lead to a win from either perspective. As such while generating the moves based on this data, a good sequence will result in a win. Of course these assumptions need to tested and validated, which will be my next step.

Essentially, in a ideal case, it may not even be necessary to hard code the rules of the game. Just like you learned to speak right in your language, without learning the grammar explicitly, the model will speak(play) the right moves(chess) with rules implicitly defined in their sequence of moves.

Redefining the problem of chess in this manner lets go of the approach of traditionally breaking the problem in board representation, search technique, and board evaluation.

--

--

Anuvesh Kumar

Interested in AI, ML, Music and Poetry. Love the nature, like to travel and explore.