added en passant to check evasion
This commit is contained in:
1 parent
70179b953d
commit
70607073bc
2 files changed
+11
-8
No files matched your search
+10
-7
@@ -344,13 +344,11 @@ static Bitboard SliderRaysToSquare(int attacker, int target) {
|
||||
Bitboard ray;
|
||||
|
||||
int direction = GetDirection(attacker, target);
|
||||
|
||||
int square = attacker;
|
||||
|
||||
if (direction) {
|
||||
while (square <= target) {
|
||||
ray.SetBit(square);
|
||||
square += direction;
|
||||
while (attacker <= target) {
|
||||
ray.SetBit(attacker);
|
||||
attacker += direction;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -473,10 +471,15 @@ static void GenCheckEvasions(Board &board, bool color) {
|
||||
|
||||
if (type == Pawn) {
|
||||
pushes |= getPawnPushes(square, color, board.occupied) & pushMask;
|
||||
} else {
|
||||
pushes |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & pushMask;
|
||||
|
||||
// Checking for en passant capture
|
||||
if ((pawnAttacks[color][square]
|
||||
& Bitboard::GetSquare(board.enPassantTarget)).GetBoard()) {
|
||||
board.AddMove(Move(square, board.enPassantTarget, epCapture));
|
||||
}
|
||||
}
|
||||
|
||||
pushes |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & pushMask;
|
||||
captures |= getPieceAttacks(square, type, color, board.occupied.GetBoard()) & captureMask;
|
||||
|
||||
while (captures.GetBoard()) {
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
|
||||
using U64 = uint64_t;
|
||||
|
||||
constexpr char StartingFen[] = "8/8/8/8/r2K4/2P5/8zz/b6k w - - 0 1";
|
||||
constexpr char StartingFen[] = "8/8/8/2k5/3Pp3/8/8/4K3 b - d3 0 1";
|
||||
|
||||
enum COLOR {
|
||||
White,
|
||||
|
||||
Reference in new issue
Block a user