# To solve chess with deep RL and MCTS, how should I represent the input (the state) to a neural network?

I'm wanting to build a NN that can create a policy for each possible state. I want to combine this with MCTS to eliminate randomness so when expansion occurs, I can get the probability of the move to winning.

I am confident (I believe) in how to code the neural network, but the input shape is the hardest part here. I am firstly wanting to try with 2 player chess and then expand to 3 player chess.

What is the best vector/matrix to use for the input in a chess game? How should the input be fed into a neural network to output the most promising move from the position? In addition, what format should it look like (i.e [001111000], etc.)?

• Coincidentally I just started coding this up a few days ago, and I had the same question. I highly recommend reading the AlphaZero paper, they give a decent description of how they encoded the states. – harwiltz Oct 9 '20 at 13:28

I think it makes sense to use a Conv2D net for evaluating each position where you have different input channels for each figure type on the board. For example one channel for pawns: an 8x8 matrix with 1's where there are white pawns, and -1's where there are black pawns. the rest should be 0. Also input channels for bishops, knights etc... and then experiment with the rest of the convolutional net. Also, there should be a way to input other information like en-passant and signals that tell wether the king has moved or not (for casteling). You could maybe use another channel for encoding these informations. I hope I could help.