diff --git a/src/history.h b/src/history.h index ec245230a..f2ef7661f 100644 --- a/src/history.h +++ b/src/history.h @@ -166,6 +166,8 @@ struct CorrHistTypedef { template using CorrectionHistory = typename Detail::CorrHistTypedef::type; +using TTMoveHistory = Stats; + } // namespace Stockfish #endif // #ifndef HISTORY_H_INCLUDED diff --git a/src/search.cpp b/src/search.cpp index dc15e6c7b..3870f37d2 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -628,6 +628,8 @@ void Search::Worker::clear() { minorPieceCorrectionHistory.fill(0); nonPawnCorrectionHistory.fill(0); + ttMoveHistory.fill(0); + for (auto& to : continuationCorrectionHistory) for (auto& h : to) h.fill(5); @@ -1190,7 +1192,8 @@ moves_loop: // When in check, search starts here { int corrValAdj1 = std::abs(correctionValue) / 248873; int corrValAdj2 = std::abs(correctionValue) / 255331; - int doubleMargin = 262 * PvNode - 188 * !ttCapture - corrValAdj1; + int doubleMargin = 262 * PvNode - 188 * !ttCapture - corrValAdj1 + - ttMoveHistory[pawn_structure_index(pos)][us] / 128; int tripleMargin = 88 + 265 * PvNode - 256 * !ttCapture + 93 * ss->ttPv - corrValAdj2; @@ -1481,8 +1484,15 @@ moves_loop: // When in check, search starts here // If there is a move that produces search value greater than alpha, // we update the stats of searched moves. else if (bestMove) + { update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth, bestMove == ttData.move, moveCount); + if (!PvNode) + { + int bonus = (ttData.move == move) ? 800 : -600 * moveCount; + ttMoveHistory[pawn_structure_index(pos)][us] << bonus; + } + } // Bonus for prior quiet countermove that caused the fail low else if (!priorCapture && prevSq != SQ_NONE) diff --git a/src/search.h b/src/search.h index 326645859..f721e9c36 100644 --- a/src/search.h +++ b/src/search.h @@ -326,6 +326,8 @@ class Worker { Value ev, uint8_t generation8); + TTMoveHistory ttMoveHistory; + private: void iterative_deepening();