Generating all the moves on a board

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

mphuget
Posts: 13
Joined: Fri Mar 01, 2019 12:46 pm
Full name: Marc-Philippe HUGET

Generating all the moves on a board

Post by mphuget »

Hello everyone,

I am doing in this moment move predictions with neural network and for the labels, that is, the move,
I decided to opt for one-hot encoding (which seems to be the best choice).

Some authors consider using all the labels we got from the training and doing the one-hot encoding on
these moves, but I was curious to see how many moves it is possible on board, and here begins my
confusion: I remember reading there are around 6000 moves but when I tried, I am far from this amount.

What did I do? Using an empty board, and a queen on a square (visiting then 64 squares) and generating all
the moves, I got 1456 moves, and I have to add knight moves for all the 64 squares. Really far from 6000.

Am I wrong?

Thanks for your answer,
mph
jhaglund2
Posts: 65
Joined: Mon Jan 16, 2017 6:28 pm

Re: Generating all the moves on a board

Post by jhaglund2 »

You are on the correct track. I did this 10 years ago. That, was when I was talking about a move interpreter, instead of move generator. Where you don't do any of that move notation stuff. All the moves are already at hand. You just have conditions met as playable with a 1|0.

King
Queen
Rook
Bishop
Knight
Pawns
  • color
  • ep
  • captures
  • promotions
Castling

While, you will get similar notations for the different pieces and colors, this inflates the total number. How you separate them is up to you. That is correct value, I also achieved for the queen. I coded each move into arrays, for each piece type and color.
Gerd Isenberg
Posts: 2250
Joined: Wed Mar 08, 2006 8:47 pm
Location: Hattingen, Germany

Re: Generating all the moves on a board

Post by Gerd Isenberg »

Move enumeration: 22678 per side considering target square occupancy and disjoint capture target piece. See
https://www.chessprogramming.org/Encodi ... numeration