4 ms·
What occurred once is not what chess programmers would call a “move”, but rather what chess players would call “move”. His definition of a move is one ply of a
by zarzavat 2y ago
What occurred once is not what chess programmers would call a “move”, but rather what chess players would call “move”.
His definition of a move is one ply of algebraic notation. From a chess programming perspective algebraic notation is just a data format and doesn’t have any greater significance.
In programming terms a move is a data structure that allows you to derive one position from another according to the rules of chess.
In Stockfish a move is a 14 bit number, the first 5 bits are the destination square, the next 5 bits are the origin square, the next 2 bits are the promotion piece, and the last 2 bits are the move type (normal, promotion, en passant or castle)
- maverwa 2y agoI was wondering on how Stockfish encodes the destination and origin square in 5 bits each. I think they don't, at least the code on github uses 6 bits each, which actually gives you 64 possible values, so works out fine: https://github.com/official-stockfish/Stockfish/blob/master/src/types.h#L351-L361 https://github.com/official-stockfish/Stockfish/blob/master/... Thats 16 bits. Thank you for sending me down that (small) rabbit hole!
- zarzavat 2y agoYes you are correct, I had 2^5 = 64 in my head for some reason.
- Retric 2y agoComparing games with that notation alone would make moving your queen e2-e3 in game A the same as moving a pawn e2-e3 in game 2. I don’t think anyone would actually agree those are the same move. What Stockfish considers a move includes the full board state, it simply doesn’t need to pass that information around internally. Thus removing that ambiguity but means there’s a great number of moves that have only occurred once. Also, it’s 6bit + 6bit + 2bit + 2bit = 16 bits which isn’t an arbitrary number. There’s no need to actually encode that something is a promotion because it can be inferred from the board state, but there’s zero cost to pass an extra bit around so it’s included anyway.
- deleted 2y ago[deleted]