mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 19:16:49 +08:00
Merge pull request #322 from fsmosca/tb-issue-6
Fix ranking of root moves by TB
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user