Castle is part of the 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.
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.