X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=0619db3a12a2420a2ef85864ab84e709c614a158;hp=9a826d3724dc43bc7e6e8bff935f064ac18d5104;hb=12e79be91039796299187ba1b2f1559552642ea4;hpb=3913726d1c8ef3b994dd8090c98814fa7e7f5874 diff --git a/src/search.cpp b/src/search.cpp index 9a826d37..0619db3a 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -290,7 +290,7 @@ void Thread::search() { std::memset(ss-4, 0, 7 * sizeof(Stack)); for (int i = 4; i > 0; i--) - (ss-i)->contHistory = this->contHistory[NO_PIECE][0].get(); // Use as sentinel + (ss-i)->continuationHistory = this->continuationHistory[NO_PIECE][0].get(); // Use as sentinel bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; @@ -587,7 +587,7 @@ namespace { (ss+1)->ply = ss->ply + 1; ss->currentMove = (ss+1)->excludedMove = bestMove = MOVE_NONE; - ss->contHistory = thisThread->contHistory[NO_PIECE][0].get(); + ss->continuationHistory = thisThread->continuationHistory[NO_PIECE][0].get(); (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; Square prevSq = to_sq((ss-1)->currentMove); @@ -751,7 +751,7 @@ namespace { Depth R = ((823 + 67 * depth / ONE_PLY) / 256 + std::min((eval - beta) / PawnValueMg, 3)) * ONE_PLY; ss->currentMove = MOVE_NULL; - ss->contHistory = thisThread->contHistory[NO_PIECE][0].get(); + ss->continuationHistory = thisThread->continuationHistory[NO_PIECE][0].get(); pos.do_null_move(st); @@ -802,7 +802,7 @@ namespace { probCutCount++; ss->currentMove = move; - ss->contHistory = thisThread->contHistory[pos.moved_piece(move)][to_sq(move)].get(); + ss->continuationHistory = thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)].get(); assert(depth >= 5 * ONE_PLY); @@ -835,7 +835,7 @@ namespace { moves_loop: // When in check, search starts from here - const PieceToHistory* contHist[] = { (ss-1)->contHistory, (ss-2)->contHistory, nullptr, (ss-4)->contHistory }; + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; Move countermove = thisThread->counterMoves[pos.piece_on(prevSq)][prevSq]; MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, @@ -970,7 +970,7 @@ moves_loop: // When in check, search starts from here // Update the current move (this must be done after singular extension search) ss->currentMove = move; - ss->contHistory = thisThread->contHistory[movedPiece][to_sq(move)].get(); + ss->continuationHistory = thisThread->continuationHistory[movedPiece][to_sq(move)].get(); // Step 15. Make the move pos.do_move(move, st, givesCheck); @@ -1212,8 +1212,10 @@ moves_loop: // When in check, search starts from here ss->pv[0] = MOVE_NONE; } + Thread* thisThread = pos.this_thread(); (ss+1)->ply = ss->ply + 1; ss->currentMove = bestMove = MOVE_NONE; + ss->continuationHistory = thisThread->continuationHistory[NO_PIECE][0].get(); inCheck = pos.checkers(); moveCount = 0; @@ -1283,12 +1285,15 @@ moves_loop: // When in check, search starts from here futilityBase = bestValue + 128; } + const PieceToHistory* contHist[] = { (ss-1)->continuationHistory, (ss-2)->continuationHistory, nullptr, (ss-4)->continuationHistory }; + // Initialize a MovePicker object for the current position, and prepare // to search the moves. Because the depth is <= 0 here, only captures, // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will // be generated. - MovePicker mp(pos, ttMove, depth, &pos.this_thread()->mainHistory, - &pos.this_thread()->captureHistory, + MovePicker mp(pos, ttMove, depth, &thisThread->mainHistory, + &thisThread->captureHistory, + contHist, to_sq((ss-1)->currentMove)); // Loop through the moves until no moves remain or a beta cutoff occurs @@ -1345,6 +1350,7 @@ moves_loop: // When in check, search starts from here } ss->currentMove = move; + ss->continuationHistory = thisThread->continuationHistory[pos.moved_piece(move)][to_sq(move)].get(); // Make and search the move pos.do_move(move, st, givesCheck); @@ -1436,7 +1442,7 @@ moves_loop: // When in check, search starts from here for (int i : {1, 2, 4}) if (is_ok((ss-i)->currentMove)) - (*(ss-i)->contHistory)[pc][to] << bonus; + (*(ss-i)->continuationHistory)[pc][to] << bonus; }