mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-20 17:16:33 +08:00
Fix move_is_capture() to detect capture promotions
We miss to account as a capture a promotion capture !
Incredible bug in this critical function that is here
since a long time (b50921fd5c of 21/10/2009 !!)
This patch fixes the bug and readds the faster
move_is_capture_or_promotion() that slightly increases
overall speed.
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
@@ -1013,7 +1013,7 @@ split_point_start: // At split points actual search starts from here
|
||||
// At Root and at first iteration do a PV search on all the moves to score root moves
|
||||
isPvMove = (PvNode && moveCount <= (RootNode ? depth <= ONE_PLY ? MAX_MOVES : MultiPV : 1));
|
||||
givesCheck = pos.move_gives_check(move, ci);
|
||||
captureOrPromotion = pos.move_is_capture(move) || move_is_promotion(move);
|
||||
captureOrPromotion = pos.move_is_capture_or_promotion(move);
|
||||
|
||||
// Step 12. Decide the new search depth
|
||||
ext = extension<PvNode>(pos, move, captureOrPromotion, givesCheck, &dangerous);
|
||||
@@ -1279,8 +1279,7 @@ split_point_start: // At split points actual search starts from here
|
||||
|
||||
// Update killers and history only for non capture moves that fails high
|
||||
if ( bestValue >= beta
|
||||
&& !pos.move_is_capture(move)
|
||||
&& !move_is_promotion(move))
|
||||
&& !pos.move_is_capture_or_promotion(move))
|
||||
{
|
||||
if (move != ss->killers[0])
|
||||
{
|
||||
@@ -1450,8 +1449,7 @@ split_point_start: // At split points actual search starts from here
|
||||
&& !inCheck
|
||||
&& givesCheck
|
||||
&& move != ttMove
|
||||
&& !pos.move_is_capture(move)
|
||||
&& !move_is_promotion(move)
|
||||
&& !pos.move_is_capture_or_promotion(move)
|
||||
&& ss->eval + PawnValueMidgame / 4 < beta
|
||||
&& !check_is_dangerous(pos, move, futilityBase, beta, &bestValue))
|
||||
{
|
||||
@@ -1650,7 +1648,7 @@ split_point_start: // At split points actual search starts from here
|
||||
|
||||
assert(move_is_ok(m));
|
||||
assert(threat && move_is_ok(threat));
|
||||
assert(!pos.move_is_capture(m) && !move_is_promotion(m));
|
||||
assert(!pos.move_is_capture_or_promotion(m));
|
||||
assert(!pos.move_is_passed_pawn_push(m));
|
||||
|
||||
Square mfrom, mto, tfrom, tto;
|
||||
|
||||
Reference in New Issue
Block a user