File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed
Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -1277,8 +1277,9 @@ bool Position::legal(Move m) const {
12771277
12781278 Bitboard attackers = attackers_to (gating_square (m), occ, ~us);
12791279
1280- // Ignore attacks from squares that will be cleared as part of the move
1281- attackers &= ~SquareBB[to];
1280+ // Ignore attacks from enemy pieces that will be removed as part of the move
1281+ if (capture (m) && piece_on (to) != NO_PIECE)
1282+ attackers &= ~SquareBB[to];
12821283 if (type_of (m) == EN_PASSANT)
12831284 attackers &= ~SquareBB[capture_square (to)];
12841285
Original file line number Diff line number Diff line change @@ -435,7 +435,7 @@ def test_chess_promotion_does_not_gate(self):
435435 self .assertEqual (fen , "Q7/8/8/8/8/8/7p/7K b - - 0 1" )
436436
437437 def test_battlekings_king_spawn_blocked (self ):
438- fen = "8/8/8/8/8/3p4 /4Q3/8 w - - 0 1"
438+ fen = "8/8/8/8/8/4r3 /4Q3/4r3 w - - 0 1"
439439 moves = sf .legal_moves ("battlekings" , fen , [])
440440 self .assertFalse (moves )
441441
You can’t perform that action at this time.
0 commit comments