====== Chess - Programming - Polyglot Book Format - Castle ====== **Castle** is part of the [[Chess:Programming:Polyglot Book Format:Key|Key]] It is the exclusive or of entries from the **RANDOM_CASTLE** sub-array. The offsets are computed as: ^Color^Castle Side^Offset^ |White|King-side Castle|0| |White|Queen-side Castle|1| |Black|King-side Castle|2| |Black|Queen-side Castle|3| **NOTE:** These flags are all true in the starting position and are only updated **after** the appropriate King, Rook or Castling moves. * The default value for this field should be 0 if if none of these flags apply; i.e. then castle=0. **WARNING:** Even though the flag may indicate that castleling can be done, a program should verify that a Castle-move is actually valid, as some mistakes may creep in.