mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 03:57:45 +00:00
22a5f91aa7
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.