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); } diff --git a/src/thread.cpp b/src/thread.cpp index f035186b..8f727ea8 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -232,24 +232,6 @@ void ThreadPool::start_thinking(Position& pos, StateListPtr& states, th->rootMoves = rootMoves; th->rootPos.set(pos.fen(), pos.is_chess960(), &th->rootState, th); th->rootState = setupStates->back(); - // This is also set by rank_root_moves but we need to set it - // also when there is no legal moves. - th->rootInTB = 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; - } - - if (!rootMoves.empty()) - Tablebases::rank_root_moves(pos, rootMoves); - } main()->start_searching();