X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=da95877cf793f232a7b2f6c600fbb8895b612189;hp=c163e8eac590cade95af87ccab64189b38c0a677;hb=f2e78d9f841b53b8d512ad2687ff982cf841df58;hpb=e7cfe42d3f5bf385bcfafebeabd9eb887f0f21ce diff --git a/src/search.cpp b/src/search.cpp index c163e8ea..da95877c 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -284,7 +284,7 @@ namespace { if ( captureOrPromotion && type_of(pos.piece_on(move_to(m))) != PAWN && ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK) - - piece_value_midgame(pos.piece_on(move_to(m))) == VALUE_ZERO) + - PieceValueMidgame[pos.piece_on(move_to(m))] == VALUE_ZERO) && !is_special(m)) { result += PawnEndgameExtension[PvNode]; @@ -1244,9 +1244,11 @@ split_point_start: // At split points actual search starts from here } // Step 20. Check for mate and stalemate - // All legal moves have been searched and if there are - // no legal moves, it must be mate or stalemate. - // If one move was excluded return fail low score. + // All legal moves have been searched and if there are no legal moves, it + // must be mate or stalemate. Note that we can have a false positive in + // case of StopRequest or thread.cutoff_occurred() are set, but this is + // harmless because return value is discarded anyhow in the parent nodes. + // If we are in a singular extension search then return a fail low score. if (!SpNode && !moveCount) return excludedMove ? oldAlpha : inCheck ? value_mated_in(ss->ply) : VALUE_DRAW; @@ -1397,7 +1399,7 @@ split_point_start: // At split points actual search starts from here && !pos.is_passed_pawn_push(move)) { futilityValue = futilityBase - + piece_value_endgame(pos.piece_on(move_to(move))) + + PieceValueEndgame[pos.piece_on(move_to(move))] + (is_enpassant(move) ? PawnValueEndgame : VALUE_ZERO); if (futilityValue < beta) @@ -1530,7 +1532,7 @@ split_point_start: // At split points actual search starts from here while (b) { victimSq = pop_1st_bit(&b); - futilityValue = futilityBase + piece_value_endgame(pos.piece_on(victimSq)); + futilityValue = futilityBase + PieceValueEndgame[pos.piece_on(victimSq)]; // Note that here we generate illegal "double move"! if ( futilityValue >= beta @@ -1654,7 +1656,7 @@ split_point_start: // At split points actual search starts from here // Case 2: If the threatened piece has value less than or equal to the // value of the threatening piece, don't prune moves which defend it. if ( pos.is_capture(threat) - && ( piece_value_midgame(pos.piece_on(tfrom)) >= piece_value_midgame(pos.piece_on(tto)) + && ( PieceValueMidgame[pos.piece_on(tfrom)] >= PieceValueMidgame[pos.piece_on(tto)] || type_of(pos.piece_on(tfrom)) == KING) && pos.move_attacks_square(m, tto)) return true;