mirror of
https://github.com/sockspls/badfish
synced 2025-05-01 01:03:09 +00:00
Fix two bugs in ok_to_prune() (2)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
07b45151d2
commit
8ee3124487
1 changed files with 17 additions and 14 deletions
|
@ -2158,31 +2158,34 @@ namespace {
|
||||||
tto = move_to(threat);
|
tto = move_to(threat);
|
||||||
|
|
||||||
// Case 1: Castling moves are never pruned.
|
// Case 1: Castling moves are never pruned.
|
||||||
if(move_is_castle(m))
|
if (move_is_castle(m))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Case 2: Don't prune moves which move the threatened piece
|
// Case 2: Don't prune moves which move the threatened piece
|
||||||
if(!PruneEscapeMoves && threat != MOVE_NONE && mfrom == tto)
|
if (!PruneEscapeMoves && threat != MOVE_NONE && mfrom == tto)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Case 3: If the threatened piece has value less than or equal to the
|
// Case 3: If the threatened piece has value less than or equal to the
|
||||||
// value of the threatening piece, don't prune move which defend it.
|
// value of the threatening piece, don't prune move which defend it.
|
||||||
if(!PruneDefendingMoves && threat != MOVE_NONE
|
if ( !PruneDefendingMoves
|
||||||
&& (piece_value_midgame(pos.piece_on(tfrom))
|
&& threat != MOVE_NONE
|
||||||
>= piece_value_midgame(pos.piece_on(tto)))
|
&& pos.type_of_piece_on(tto) != NO_PIECE_TYPE
|
||||||
&& pos.move_attacks_square(m, tto))
|
&& ( pos.midgame_value_of_piece_on(tfrom) >= pos.midgame_value_of_piece_on(tto)
|
||||||
|
|| pos.type_of_piece_on(tfrom) == KING)
|
||||||
|
&& pos.move_attacks_square(m, tto))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Case 4: Don't prune moves with good history.
|
// Case 4: Don't prune moves with good history.
|
||||||
if(!H.ok_to_prune(pos.piece_on(move_from(m)), m, d))
|
if (!H.ok_to_prune(pos.piece_on(move_from(m)), m, d))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Case 5: If the moving piece in the threatened move is a slider, don't
|
// Case 5: If the moving piece in the threatened move is a slider, don't
|
||||||
// prune safe moves which block its ray.
|
// prune safe moves which block its ray.
|
||||||
if(!PruneBlockingMoves && threat != MOVE_NONE
|
if ( !PruneBlockingMoves
|
||||||
&& piece_is_slider(pos.piece_on(tfrom))
|
&& threat != MOVE_NONE
|
||||||
&& bit_is_set(squares_between(tfrom, tto), mto) && pos.see(m) >= 0)
|
&& piece_is_slider(pos.piece_on(tfrom))
|
||||||
return false;
|
&& bit_is_set(squares_between(tfrom, tto), mto) && pos.see(m) >= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue