6

In a neural network for chess (or checkers), the output is a piece or square on the board and an end position.

How would one encode this?

As far as I can see choosing a starting square is 8x8=64 outputs and an ending square is 8x8=64 outputs. So the total number of possible moves is 64x64 4096 outputs. Giving a probability for every possible move.

Is this correct? This seems like an awful lot of outputs!

Maxim
  • 2,027
  • 2
  • 17
  • 27
zooby
  • 2,260
  • 1
  • 14
  • 22

2 Answers2

5

The number is 4672 from Google.

https://arxiv.org/pdf/1712.01815.pdf

A move in chess may be described in two parts: selecting the piece to move, and then
selecting among the legal moves for that piece. We represent the policy π(a|s) by a 8 × 8 × 73
stack of planes encoding a probability distribution over 4,672 possible moves. Each of the 8×8
positions identifies the square from which to “pick up” a piece.

4672 might sound a big number but it's nothing to what Google (and many other competitors) has been doing to deep learning for image analysis.

SmallChess
  • 1,421
  • 1
  • 9
  • 14
0

I wanted to answer @bizi's question, because it was confusing me too. The promotion to queen is handled by the "1-N, 1-NE, and 1-NW" components of the 56 possible queen moves. They're saying that if a pawn makes one of those moves, from the 7th rank, then it will promote to queen.

The 9 other dimensions need to exist to give the pawn the option to make the 1-N, 1-NE, and 1-NW moves from the 7th to the 8th rank, but NOT promote to a queen. Hence there are 3 directions x 3 UNDER-promotions and 9 total options.

Additionally, I think you could do an even more minimal representation if you cut out some starting position + move directions that are inherently illegal (i.e. would put the piece off the edge of the board).

Still working on it, but my script arrives at 1724 possible moves with this encoding.