1. Chess960 requires an additional check iff the castling is A-side AND the rook is on the B square and
2. checking for enemy R or Q on the A square will suffice?
My current implementation uses the upper 4 bits of the castle flags as follows:
Code: Select all
bool check_castle_mask(const board_t* b, uint16_t i) {
return b->castle & (0x10 << i)
&& (b->mbox[(i & 2) ? 0x30 : 0x00].v & 0xB0) == ((i & 2) ? 0xA0 : 0xB0);
}
Thanks in advance!