From 1c8686d81c58ee32c0dced43102bdbf785f3313c Mon Sep 17 00:00:00 2001 From: "rektdie@gmail.com" Date: Mon, 8 Apr 2024 22:09:55 +0200 Subject: [PATCH] bugfix: IsLegalEnPassant() --- source/movegen.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/movegen.cpp b/source/movegen.cpp index 406cd93..17e40e0 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -400,9 +400,9 @@ static bool IsLegalEnPassant(Board &board, int square) { // Looking for horizontal checks if (!(kingSquare.GetBoard() & files[A])) { - int currentSq = kingSquare.getLS1BIndex() + east; + int currentSq = kingSquare.getLS1BIndex() + west; - while (!Bitboard(files[A]).IsSet(currentSq)) { + while (!Bitboard(files[H]).IsSet(currentSq)) { if (newOccupancy.IsSet(currentSq)) { int attackerColor = board.GetPieceColor(currentSq); int attackerType = board.GetPieceType(currentSq); @@ -413,7 +413,7 @@ static bool IsLegalEnPassant(Board &board, int square) { } return true; } - currentSq += east; + currentSq += west; } }