glinscott / leela-chess

**MOVED TO https://github.com/LeelaChessZero/leela-chess ** A chess adaption of GCP's Leela Zero
http://lczero.org
GNU General Public License v3.0
760 stars 301 forks source link

chess-alpha-zero #719

Open Vovak1919 opened 4 years ago

Vovak1919 commented 4 years ago

I am trying to understand the old chess-alpha-zero program in Python. Maybe someone who has done this before will tell me where the moves are implemented in the code, as written in the article "Mastering Chess and Shogi by Self-Play with a General Reinforcement Learning Algorithm", p.13:

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 pi(ajs) 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. The first 56 planes encode possible ‘queen moves’ for any piece: a number of squares [1::7] in which the piece will be moved, along one of eight relative compass directions fN;NE;E; SE; S; SW;W;NWg. The next 8 planes encode possible knight moves for that piece. The final 9 planes encode possible underpromotions for pawn moves or captures in two possible diagonals, to knight, bishop or rook respectively. Other pawn moves or captures from the seventh rank are promoted to a queen.