diff --git a/src/search.cpp b/src/search.cpp index e6ee4274e..ef87c828e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -137,7 +137,8 @@ void update_all_stats(const Position& pos, SearchedList& quietsSearched, SearchedList& capturesSearched, Depth depth, - Move TTMove); + Move TTMove, + int moveCount); } // namespace @@ -1391,7 +1392,7 @@ moves_loop: // When in check, search starts here else if (bestMove) { update_all_stats(pos, ss, *this, bestMove, prevSq, quietsSearched, capturesSearched, depth, - ttData.move); + ttData.move, moveCount); if (!PvNode) ttMoveHistory << (bestMove == ttData.move ? 809 : -865); } @@ -1801,41 +1802,42 @@ void update_all_stats(const Position& pos, SearchedList& quietsSearched, SearchedList& capturesSearched, Depth depth, - Move ttMove) { + Move ttMove, + int moveCount) { CapturePieceToHistory& captureHistory = workerThread.captureHistory; Piece movedPiece = pos.moved_piece(bestMove); PieceType capturedPiece; - int bonus = std::min(151 * depth - 91, 1730) + 302 * (bestMove == ttMove); - int malus = std::min(951 * depth - 156, 2468) - 30 * quietsSearched.size(); + int bonus = std::min(121 * depth - 77, 1633) + 375 * (bestMove == ttMove); + int malus = std::min(825 * depth - 196, 2159) - 16 * moveCount; if (!pos.capture_stage(bestMove)) { - update_quiet_histories(pos, ss, workerThread, bestMove, bonus * 957 / 1024); + update_quiet_histories(pos, ss, workerThread, bestMove, bonus * 881 / 1024); // Decrease stats for all non-best quiet moves for (Move move : quietsSearched) - update_quiet_histories(pos, ss, workerThread, move, -malus); + update_quiet_histories(pos, ss, workerThread, move, -malus * 1083 / 1024); } else { // Increase stats for the best move in case it was a capture move capturedPiece = type_of(pos.piece_on(bestMove.to_sq())); - captureHistory[movedPiece][bestMove.to_sq()][capturedPiece] << bonus; + captureHistory[movedPiece][bestMove.to_sq()][capturedPiece] << bonus * 1482 / 1024; } // Extra penalty for a quiet early move that was not a TT move in // previous ply when it gets refuted. if (prevSq != SQ_NONE && ((ss - 1)->moveCount == 1 + (ss - 1)->ttHit) && !pos.captured_piece()) - update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -malus * 503 / 1024); + update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -malus * 614 / 1024); // Decrease stats for all non-best capture moves for (Move move : capturesSearched) { movedPiece = pos.moved_piece(move); capturedPiece = type_of(pos.piece_on(move.to_sq())); - captureHistory[movedPiece][move.to_sq()][capturedPiece] << -malus * 1157 / 1024; + captureHistory[movedPiece][move.to_sq()][capturedPiece] << -malus * 1397 / 1024; } }