bugfix: looking for checkers in isLegalEnPassant didn't start from the king

This commit is contained in:
rektdie committed 2024-04-16 16:24:57 +02:00
1 parent 9c787303f8
commit 28d8b2689f
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -9,7 +9,7 @@ int main() {
initSliderAttacks(); initSliderAttacks();
Board board; Board board;
board.SetByFen("r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1"); board.SetByFen("rnbq1k1r/pp1Pbppp/2p5/8/2B5/8/PPP1NnPP/RNBQK2R w KQ - 1 8");
Perft(board, 6); Perft(board, 6);
return 0; return 0;
+1 -1
View File
@@ -440,7 +440,7 @@ static bool IsLegalEnPassant(Board &board, int square) {
// Either east or west // Either east or west
if (abs(directionToKing) == 1) { if (abs(directionToKing) == 1) {
int currentSq = square - directionToKing; int currentSq = kingSquare.getLS1BIndex() - directionToKing;
Bitboard endingFile = directionToKing > 0 ? files[H] : files[A]; Bitboard endingFile = directionToKing > 0 ? files[H] : files[A];