From 44f4d6f617b3f82216e10e5171e885b380b764f5 Mon Sep 17 00:00:00 2001 From: fsmosca Date: Tue, 13 Apr 2021 18:54:19 +0800 Subject: [PATCH] Fix ranking of root moves by TB --- src/search.cpp | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 30384868..8fe35000 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -309,6 +309,9 @@ void Thread::search() { bestValue = delta = alpha = -VALUE_INFINITE; beta = VALUE_INFINITE; + if (!this->rootMoves.empty()) + Tablebases::rank_root_moves(this->rootPos, this->rootMoves); + if (mainThread) { if (mainThread->bestPreviousScore == VALUE_INFINITE) @@ -1934,10 +1937,14 @@ bool RootMove::extract_ponder_from_tt(Position& pos) { void Tablebases::rank_root_moves(Position& pos, Search::RootMoves& rootMoves) { - auto& rootInTB = pos.this_thread()->rootInTB; + pos.this_thread()->Cardinality = int(Options["SyzygyProbeLimit"]); + pos.this_thread()->ProbeDepth = int(Options["SyzygyProbeDepth"]); + pos.this_thread()->UseRule50 = bool(Options["Syzygy50MoveRule"]); + pos.this_thread()->rootInTB = false; + auto& cardinality = pos.this_thread()->Cardinality; auto& probeDepth = pos.this_thread()->ProbeDepth; - rootInTB = false; + auto& rootInTB = pos.this_thread()->rootInTB; bool dtz_available = true; // Tables with fewer pieces than SyzygyProbeLimit are searched with @@ -2044,18 +2051,6 @@ namespace Search if (rootMoves.empty()) return false; - th->UseRule50 = bool(Options["Syzygy50MoveRule"]); - th->ProbeDepth = int(Options["SyzygyProbeDepth"]); - th->Cardinality = int(Options["SyzygyProbeLimit"]); - - // Tables with fewer pieces than SyzygyProbeLimit are searched with - // ProbeDepth == DEPTH_ZERO - if (th->Cardinality > Tablebases::MaxCardinality) - { - th->Cardinality = Tablebases::MaxCardinality; - th->ProbeDepth = 0; - } - Tablebases::rank_root_moves(pos, rootMoves); }