mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
SEE: add support for enpassant moves
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
2d0146fe1d
commit
72ca727b38
2 changed files with 17 additions and 1 deletions
|
@ -1626,6 +1626,21 @@ int Position::see(Square from, Square to) const {
|
||||||
// Find all attackers to the destination square, with the moving piece
|
// Find all attackers to the destination square, with the moving piece
|
||||||
// removed, but possibly an X-ray attacker added behind it.
|
// removed, but possibly an X-ray attacker added behind it.
|
||||||
occ = occupied_squares();
|
occ = occupied_squares();
|
||||||
|
|
||||||
|
// Handle enpassant moves
|
||||||
|
if (ep_square() == to && type_of_piece_on(from) == PAWN)
|
||||||
|
{
|
||||||
|
assert(capture == EMPTY);
|
||||||
|
|
||||||
|
Square capQq = (side_to_move() == WHITE)? (to - DELTA_N) : (to - DELTA_S);
|
||||||
|
capture = piece_on(capQq);
|
||||||
|
|
||||||
|
assert(type_of_piece_on(capQq) == PAWN);
|
||||||
|
|
||||||
|
// Remove the captured pawn
|
||||||
|
clear_bit(&occ, capQq);
|
||||||
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
clear_bit(&occ, from);
|
clear_bit(&occ, from);
|
||||||
|
|
|
@ -2284,7 +2284,8 @@ namespace {
|
||||||
if ( !PruneBlockingMoves
|
if ( !PruneBlockingMoves
|
||||||
&& threat != MOVE_NONE
|
&& threat != MOVE_NONE
|
||||||
&& piece_is_slider(pos.piece_on(tfrom))
|
&& piece_is_slider(pos.piece_on(tfrom))
|
||||||
&& bit_is_set(squares_between(tfrom, tto), mto) && pos.see(m) >= 0)
|
&& bit_is_set(squares_between(tfrom, tto), mto)
|
||||||
|
&& pos.see(m) >= 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Reference in a new issue