X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=c54c1269089ed9237558f4adb18595573235b4ea;hp=4f4092ffe2bcae830f54ba84fc62c42ede9ab094;hb=e0504ab876a997321102f040ab88203cb893db12;hpb=8b2c81d3ea6eae49d5c0b7ffcff1de9eff1cd730 diff --git a/src/search.cpp b/src/search.cpp index 4f4092ff..c54c1269 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -211,7 +211,6 @@ void Search::clear() { for (Thread* th : Threads) { - th->history.clear(); th->counterMoves.clear(); th->fromTo.clear(); th->counterMoveHistory.clear(); @@ -316,8 +315,7 @@ void MainThread::search() { Depth depthDiff = th->completedDepth - bestThread->completedDepth; Value scoreDiff = th->rootMoves[0].score - bestThread->rootMoves[0].score; - if ( (depthDiff > 0 && scoreDiff >= 0) - || (scoreDiff > 0 && depthDiff >= 0)) + if (scoreDiff > 0 && depthDiff >= 0) bestThread = th; } } @@ -643,7 +641,7 @@ namespace { && (ttValue >= beta ? (tte->bound() & BOUND_LOWER) : (tte->bound() & BOUND_UPPER))) { - // If ttMove is quiet, update killers, history, counter move on TT hit + // If ttMove is quiet, update move sorting heuristics on TT hit if (ttValue >= beta && ttMove) { if (!pos.capture_or_promotion(ttMove)) @@ -984,12 +982,11 @@ moves_loop: // When in check search starts from here && !pos.see_ge(make_move(to_sq(move), from_sq(move)), VALUE_ZERO)) r -= 2 * ONE_PLY; - ss->history = thisThread->history[moved_piece][to_sq(move)] - + (cmh ? (*cmh )[moved_piece][to_sq(move)] : VALUE_ZERO) - + (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO) - + (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO) - + thisThread->fromTo.get(~pos.side_to_move(), move) - - 8000; // Correction factor + ss->history = (cmh ? (*cmh )[moved_piece][to_sq(move)] : VALUE_ZERO) + + (fmh ? (*fmh )[moved_piece][to_sq(move)] : VALUE_ZERO) + + (fmh2 ? (*fmh2)[moved_piece][to_sq(move)] : VALUE_ZERO) + + thisThread->fromTo.get(~pos.side_to_move(), move) + - 8000; // Correction factor // Decrease/increase reduction by comparing opponent's stat score if (ss->history > VALUE_ZERO && (ss-1)->history < VALUE_ZERO) @@ -1119,7 +1116,7 @@ moves_loop: // When in check search starts from here else if (bestMove) { - // Quiet best move: update killers, history and countermoves + // Quiet best move: update move sorting heuristics if (!pos.capture_or_promotion(bestMove)) update_stats(pos, ss, bestMove, quietsSearched, quietCount, bonus(depth)); @@ -1405,8 +1402,7 @@ moves_loop: // When in check search starts from here } - // update_stats() updates killers, history, countermove and countermove plus - // follow-up move history when a new quiet best move is found. + // update_stats() updates move sorting heuristics when a new quiet best move is found void update_stats(const Position& pos, Stack* ss, Move move, Move* quiets, int quietsCnt, Value bonus) { @@ -1420,7 +1416,6 @@ moves_loop: // When in check search starts from here Color c = pos.side_to_move(); Thread* thisThread = pos.this_thread(); thisThread->fromTo.update(c, move, bonus); - thisThread->history.update(pos.moved_piece(move), to_sq(move), bonus); update_cm_stats(ss, pos.moved_piece(move), to_sq(move), bonus); if ((ss-1)->counterMoves) @@ -1433,7 +1428,6 @@ moves_loop: // When in check search starts from here for (int i = 0; i < quietsCnt; ++i) { thisThread->fromTo.update(c, quiets[i], -bonus); - thisThread->history.update(pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus); update_cm_stats(ss, pos.moved_piece(quiets[i]), to_sq(quiets[i]), -bonus); } }