Paul Webster’s Games & Blogs

Castling Representation

·

·

The castling position is held as 4 bytes in the move representation.

Castle flag 1111 which is 8 4 2 1.

int castleFlag = ((move >> 14) & 0x0F);

BytesDecimalFlagsHow to query
10008White King Side Castleif(castleFlag & 8)
01004White Queen Side Castleif(castleFlag & 4)
00102Black King Side Castleif(castleFlag & 2)
00011Black Queen Side Castleif(castleFlag & 1)

One response to “Castling Representation”
  1. […] Castling Representation […]

Leave a Reply

Your email address will not be published. Required fields are marked *