diff --git a/source/main.cpp b/source/main.cpp index c860edf..ccbed46 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -9,8 +9,9 @@ int main() { initSliderAttacks(); Board board; + board.SetByFen("r3k2r/Pppp1ppp/1b3nbN/nP6/BBP1P3/q4N2/Pp1P2PP/R2Q1RK1 w kq - 0 1"); board.PrintBoard(); - Perft(board, 3); + Perft(board, 1); return 0; } \ No newline at end of file diff --git a/source/movegen.cpp b/source/movegen.cpp index 95c8c9d..6738bb8 100644 --- a/source/movegen.cpp +++ b/source/movegen.cpp @@ -824,6 +824,7 @@ static void GenCheckEvasions(Board &board, bool color) { if (checkerType == Rook || checkerType == Bishop || checkerType == Queen) { pushMask = SliderRayToSquare(checkerSquare, kingSquare); + pushMask.PopBit(kingSquare); } // looping through own pieces to add captures and blocks @@ -843,15 +844,15 @@ static void GenCheckEvasions(Board &board, bool color) { if (type == Pawn) { pushes |= getPawnPushes(square, color, board.occupied) & pushMask; - // Checking for en passant capture if ((pawnAttacks[color][square] & Bitboard::GetSquare(board.enPassantTarget)).GetBoard()) { board.AddMove(Move(square, board.enPassantTarget, epCapture)); } + } else { + pushes |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & pushMask; } - pushes |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & pushMask; captures |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & captureMask; while (captures.GetBoard()) {