Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We have a crash with this position: rkqbnnbr/pppppppp/8/8/8/8/PPPPPPPP/RKQBNNBR w HAha - What happens is that even if we are castling QUEEN_SIDE, in this case we have kfrom (B8) < kto (C8) so the loop that checks for attackers runs forever leading to a crash. The fix is to check for (kto > kfrom) instead of Side == KING_SIDE, but this is slower in the normal case of ortodhox chess, so rewrite generate_castle() to handle the chess960 case as a template parameter and allow the compiler to optimize out the comparison in case of normal chess. Reported by Ray Banks.
- Loading branch information