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.


  • $\begingroup$ 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. $\endgroup$ – nbro Sep 28 '20 at 21:18
  • $\begingroup$ 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. $\endgroup$ – 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.