Table of Contents

Chess - Programming - Polyglot Book Format - Move

A Move is encoded as a bit field:

BitsDescription
0,1,2The destination file.
3,4,5The destination rank.
6,7,8The source file.
9,10,11The source rank.
12,13,14Promotion piece.

NOTE: Bit 0 is the least significant bit.


Promotion Moves

A Promoted Piece is encoded as follows:

Promoted Piece Value
None 0
Knight 1
Bishop 2
Rook 3
Queen 4

Castling Moves

Castling moves are represented unconventionally as follows:

ColorCastle SidePolygot Move
WhiteKing-side Castlee1h1
WhiteQueen-side Castlee1a1
BlackKing-side Castlee8h8
BlackQueen-side Castlee8a8

NOTE: It is technically possible that these moves are legal non-castling moves.

  • Therefore a program should verify that a Castle-move was actually valid.
    • For example, verify that there is really a king present on e1/e8.