User Tools

Site Tools


chess:programming:polyglot_book_format:piece

Chess - Programming - Polyglot Book Format - Piece

Piece is part of the Key.

It is the exclusive or of entries from the RANDOM_PIECE sub-array, one for each piece on the board.

The offset of the entry in RANDOM_PIECE corresponding to a piece is computed as follows:

piece = 64 * Piece_Type + 8 * Rank + File;

Piece_Type is encoded as:

  constexpr int BlackPawn   = 0;
  constexpr int WhitePawn   = 1;
  constexpr int BlackKnight = 2;
  constexpr int WhiteKnight = 3;
  constexpr int BlackBishop = 4;
  constexpr int WhiteBishop = 5;
  constexpr int BlackRook   = 6;
  constexpr int WhitekRook  = 7;
  constexpr int BlackQueen  = 8;
  constexpr int WhiteQueen  = 9;
  constexpr int BlackKing   = 10;
  constexpr int WhiteKing   = 11;
  constexpr int None        = 12;

Rank and File are counted from 0 to 7:

SquareFileRank
a100
h170
a807
h877

Piece

chess/programming/polyglot_book_format/piece.txt · Last modified: 2022/01/11 13:55 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki