From 6daa4d667aef3d44a08e6164bc6d4d31ecb5d052 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:37:52 +0300 Subject: [PATCH 1/9] Update timeman.cpp --- src/timeman.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timeman.cpp b/src/timeman.cpp index 72a447af5b8..04a83def8f9 100644 --- a/src/timeman.cpp +++ b/src/timeman.cpp @@ -89,8 +89,8 @@ void TimeManagement::init(Search::LimitsType& limits, - moveOverhead * (2 + mtg)); // x basetime (+ z increment) - // If there is a healthy increment, timeLeft can exceed actual available - // game time for the current move, so also cap to 20% of available game time. + // If there is a healthy increment, timeLeft can exceed the actual available + // game time for the current move, so also cap to a percentage of available game time. if (limits.movestogo == 0) { // Use extra time with larger increments From 66a39c01d336c8ca1e153fda15553c28438056a7 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:50:33 +0300 Subject: [PATCH 2/9] Update search.cpp --- src/search.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 55a92947d32..96c17a1168e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -27,8 +27,8 @@ #include #include #include -#include #include +#include #include "evaluate.h" #include "misc.h" @@ -616,7 +616,7 @@ Value Search::Worker::search( update_quiet_stats(pos, ss, *this, ttMove, stat_bonus(depth)); // Extra penalty for early quiet moves of - // the previous ply (~0 Elo on STC, ~2 Elo on LTC). + // the previous ply (~1 Elo on STC, ~2 Elo on LTC) if (prevSq != SQ_NONE && (ss - 1)->moveCount <= 2 && !priorCapture) update_continuation_histories(ss - 1, pos.piece_on(prevSq), prevSq, -stat_malus(depth + 1)); @@ -696,7 +696,7 @@ Value Search::Worker::search( else if (excludedMove) { // Providing the hint that this node's accumulator will be used often - // brings significant Elo gain (~13 Elo). + // brings significant Elo gain (~13 Elo) Eval::NNUE::hint_common_parent_position(pos); unadjustedStaticEval = eval = ss->staticEval; } @@ -1072,7 +1072,7 @@ Value Search::Worker::search( extension = -1; } - // Recapture extensions (~1 Elo) + // Recapture extensions (~0 Elo on STC, ~1 Elo on LTC) else if (PvNode && move == ttMove && move.to_sq() == prevSq && thisThread->captureHistory[movedPiece][move.to_sq()] [type_of(pos.piece_on(move.to_sq()))] @@ -1110,7 +1110,7 @@ Value Search::Worker::search( if (ttCapture) r++; - // Decrease reduction for PvNodes (~3 Elo) + // Decrease reduction for PvNodes (~0 Elo on STC, ~2 Elo on LTC) if (PvNode) r--; @@ -1172,7 +1172,7 @@ Value Search::Worker::search( // Step 18. Full-depth search when LMR is skipped else if (!PvNode || moveCount > 1) { - // Increase reduction if ttMove is not present (~1 Elo) + // Increase reduction if ttMove is not present (~6 Elo) if (!ttMove) r += 2; From c4fbc8045bca3f957b7c23aa7ee7a6e002a7d683 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:53:44 +0300 Subject: [PATCH 3/9] bench: 1303971 bench: 1303971 --- src/uci.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uci.cpp b/src/uci.cpp index d1d69d69752..ebf8814757e 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -22,13 +22,13 @@ #include #include #include +#include #include #include #include #include #include #include -#include #include "benchmark.h" #include "evaluate.h" From 134fff42dcfff54945373bd44ee4b96e97d23d9c Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:55:08 +0300 Subject: [PATCH 4/9] bench: 1303971 bench: 1303971 --- src/thread_win32_osx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread_win32_osx.h b/src/thread_win32_osx.h index 1d9a834f600..16bbcceb568 100644 --- a/src/thread_win32_osx.h +++ b/src/thread_win32_osx.h @@ -29,8 +29,8 @@ #if defined(__APPLE__) || defined(__MINGW32__) || defined(__MINGW64__) || defined(USE_PTHREADS) - #include #include + #include namespace Stockfish { From 754edcf46af099b45097ff72d4a80c7859ac70b6 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:55:58 +0300 Subject: [PATCH 5/9] bench: 1303971 bench: 1303971 --- src/thread.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread.cpp b/src/thread.cpp index 95646601106..5f126c92f1c 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -19,12 +19,12 @@ #include "thread.h" #include +#include #include #include #include #include #include -#include #include "misc.h" #include "movegen.h" From d3f6e2f24a323179fa77592df2be84f6020f65b1 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:56:40 +0300 Subject: [PATCH 6/9] bench: 1303971 bench: 1303971 --- src/search.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/search.h b/src/search.h index 4a1c68bb9ce..0d909d641f7 100644 --- a/src/search.h +++ b/src/search.h @@ -25,8 +25,8 @@ #include #include #include -#include #include +#include #include "misc.h" #include "movepick.h" From 170260b01676f4218ff976b67b7f98e81f59be60 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 19:58:24 +0300 Subject: [PATCH 7/9] bench: 1303971 bench: 1303971 --- src/movepick.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/movepick.h b/src/movepick.h index 357918a90f2..09bead0286c 100644 --- a/src/movepick.h +++ b/src/movepick.h @@ -28,8 +28,8 @@ #include // IWYU pragma: keep #include "movegen.h" -#include "types.h" #include "position.h" +#include "types.h" namespace Stockfish { From dc838e8eb515a68018187ed92a2a46976d8746c1 Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 20:18:24 +0300 Subject: [PATCH 8/9] bench: 1303971 bench: 1303971 --- src/uci.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/uci.cpp b/src/uci.cpp index ebf8814757e..776b1b37e16 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -137,7 +137,7 @@ void UCI::loop() { sync_cout << "readyok" << sync_endl; // Add custom non-UCI commands, mainly for debugging purposes. - // These commands must not be used during a search! + // These commands must NOT be used during a search. else if (token == "flip") pos.flip(); else if (token == "bench") @@ -332,7 +332,7 @@ std::string UCI::value(Value v) { ss << "cp " << to_cp(v); else if (std::abs(v) <= VALUE_TB) { - const int ply = VALUE_TB - std::abs(v); // recompute ss->ply + const int ply = VALUE_TB - std::abs(v); // Recompute ss->ply ss << "cp " << (v > 0 ? 20000 - ply : -20000 + ply); } else @@ -374,9 +374,8 @@ int win_rate_model(Value v, int ply) { // The fitted model only uses data for moves in [8, 120], and is anchored at move 32. double m = std::clamp(ply / 2 + 1, 8, 120) / 32.0; - // The coefficients of a third-order polynomial fit is based on the fishtest data - // for two parameters that need to transform eval to the argument of a logistic - // function. + // The coefficients of a third-order polynomial fit is based on the fishtest data for + // two parameters that need to transform eval to the argument of a logistic function. constexpr double as[] = {-2.00568292, 10.45906746, 1.67438883, 334.45864705}; constexpr double bs[] = {-4.97134419, 36.15096345, -82.25513499, 117.35186805}; From be69eea7fae7aac412a4e2e7e3ce75beb2fe6f3c Mon Sep 17 00:00:00 2001 From: FauziAkram Date: Mon, 19 Feb 2024 20:30:54 +0300 Subject: [PATCH 9/9] bench: 1303971 bench: 1303971 --- src/movepick.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/movepick.cpp b/src/movepick.cpp index 33791922e4b..bb068f29da4 100644 --- a/src/movepick.cpp +++ b/src/movepick.cpp @@ -31,7 +31,7 @@ namespace Stockfish { namespace { enum Stages { - // generate main search moves + // Generate main search moves MAIN_TT, CAPTURE_INIT, GOOD_CAPTURE, @@ -41,17 +41,17 @@ enum Stages { BAD_CAPTURE, BAD_QUIET, - // generate evasion moves + // Generate evasion moves EVASION_TT, EVASION_INIT, EVASION, - // generate probcut moves + // Generate probcut moves PROBCUT_TT, PROBCUT_INIT, PROBCUT, - // generate qsearch moves + // Generate qsearch moves QSEARCH_TT, QCAPTURE_INIT, QCAPTURE, @@ -59,8 +59,8 @@ enum Stages { QCHECK }; -// Sort moves in descending order up to and including -// a given limit. The order of moves smaller than the limit is left unspecified. +// Sort moves in descending order up to and including a given limit. +// The order of moves smaller than the limit is left unspecified. void partial_insertion_sort(ExtMove* begin, ExtMove* end, int limit) { for (ExtMove *sortedEnd = begin, *p = begin + 1; p < end; ++p) @@ -139,9 +139,9 @@ MovePicker::MovePicker(const Position& p, Move ttm, int th, const CapturePieceTo + !(ttm && pos.capture_stage(ttm) && pos.pseudo_legal(ttm) && pos.see_ge(ttm, threshold)); } -// Assigns a numerical value to each move in a list, used -// for sorting. Captures are ordered by Most Valuable Victim (MVV), preferring -// captures with a good history. Quiets moves are ordered using the history tables. +// Assigns a numerical value to each move in a list, used for sorting. +// Captures are ordered by Most Valuable Victim (MVV), preferring captures +// with a good history. Quiets moves are ordered using the history tables. template void MovePicker::score() { @@ -177,7 +177,7 @@ void MovePicker::score() { Square from = m.from_sq(); Square to = m.to_sq(); - // histories + // Histories m.value = 2 * (*mainHistory)[pos.side_to_move()][m.from_to()]; m.value += 2 * (*pawnHistory)[pawn_structure_index(pos)][pc][to]; m.value += 2 * (*continuationHistory[0])[pc][to]; @@ -186,17 +186,17 @@ void MovePicker::score() { m.value += (*continuationHistory[3])[pc][to]; m.value += (*continuationHistory[5])[pc][to]; - // bonus for checks + // Bonus for checks m.value += bool(pos.check_squares(pt) & to) * 16384; - // bonus for escaping from capture + // Bonus for escaping from capture m.value += threatenedPieces & from ? (pt == QUEEN && !(to & threatenedByRook) ? 50000 : pt == ROOK && !(to & threatenedByMinor) ? 25000 : !(to & threatenedByPawn) ? 15000 : 0) : 0; - // malus for putting piece en prise + // Malus for putting piece en prise m.value -= !(threatenedPieces & from) ? (pt == QUEEN ? bool(to & threatenedByRook) * 50000 + bool(to & threatenedByMinor) * 10000