# Chess Neural Network - Most Optimal Input vector/matrix?

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 input in a chess game? How should 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.

Thanks.

• Hello. Welcome to AI SE! Please, take a look at ai.stackexchange.com/help/on-topic to know more about our site. Could you also put your main question in the title? Currently, the title is not very descriptive. – nbro Sep 28 at 21:18
• 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 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.