mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-15 22:56:25 +08:00
Preparations for splitting at root
No functional change Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
committed by
Marco Costalba
parent
30b3edf328
commit
13bc6ba2c6
@@ -49,7 +49,7 @@ namespace {
|
|||||||
const bool FakeSplit = false;
|
const bool FakeSplit = false;
|
||||||
|
|
||||||
// Different node types, used as template parameter
|
// Different node types, used as template parameter
|
||||||
enum NodeType { Root, PV, NonPV, SplitPointPV, SplitPointNonPV };
|
enum NodeType { Root, PV, NonPV, SplitPointRoot, SplitPointPV, SplitPointNonPV };
|
||||||
|
|
||||||
// RootMove struct is used for moves at the root of the tree. For each root
|
// RootMove struct is used for moves at the root of the tree. For each root
|
||||||
// move, we store a score, a node count, and a PV (really a refutation
|
// move, we store a score, a node count, and a PV (really a refutation
|
||||||
@@ -693,9 +693,9 @@ namespace {
|
|||||||
template <NodeType NT>
|
template <NodeType NT>
|
||||||
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
|
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
|
||||||
|
|
||||||
const bool PvNode = (NT == PV || NT == Root || NT == SplitPointPV);
|
const bool PvNode = (NT == PV || NT == Root || NT == SplitPointPV || NT == SplitPointRoot);
|
||||||
const bool SpNode = (NT == SplitPointPV || NT == SplitPointNonPV);
|
const bool SpNode = (NT == SplitPointPV || NT == SplitPointNonPV || NT == SplitPointRoot);
|
||||||
const bool RootNode = (NT == Root);
|
const bool RootNode = (NT == Root || NT == SplitPointRoot);
|
||||||
|
|
||||||
assert(alpha >= -VALUE_INFINITE && alpha <= VALUE_INFINITE);
|
assert(alpha >= -VALUE_INFINITE && alpha <= VALUE_INFINITE);
|
||||||
assert(beta > alpha && beta <= VALUE_INFINITE);
|
assert(beta > alpha && beta <= VALUE_INFINITE);
|
||||||
@@ -996,14 +996,14 @@ split_point_start: // At split points actual search starts from here
|
|||||||
|
|
||||||
// If it's time to send nodes info, do it here where we have the
|
// If it's time to send nodes info, do it here where we have the
|
||||||
// correct accumulated node counts searched by each thread.
|
// correct accumulated node counts searched by each thread.
|
||||||
if (SendSearchedNodes)
|
if (!SpNode && SendSearchedNodes)
|
||||||
{
|
{
|
||||||
SendSearchedNodes = false;
|
SendSearchedNodes = false;
|
||||||
cout << "info" << speed_to_uci(pos.nodes_searched()) << endl;
|
cout << "info" << speed_to_uci(pos.nodes_searched()) << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For long searches send current move info to GUI
|
// For long searches send current move info to GUI
|
||||||
if (current_search_time() > 2000)
|
if (pos.thread() == 0 && current_search_time() > 2000)
|
||||||
cout << "info" << depth_to_uci(depth)
|
cout << "info" << depth_to_uci(depth)
|
||||||
<< " currmove " << move
|
<< " currmove " << move
|
||||||
<< " currmovenumber " << moveCount + MultiPVIteration << endl;
|
<< " currmovenumber " << moveCount + MultiPVIteration << endl;
|
||||||
@@ -1170,25 +1170,6 @@ split_point_start: // At split points actual search starts from here
|
|||||||
alpha = sp->alpha;
|
alpha = sp->alpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value > bestValue)
|
|
||||||
{
|
|
||||||
bestValue = value;
|
|
||||||
ss->bestMove = move;
|
|
||||||
|
|
||||||
if ( !RootNode
|
|
||||||
&& PvNode
|
|
||||||
&& value > alpha
|
|
||||||
&& value < beta) // We want always alpha < beta
|
|
||||||
alpha = value;
|
|
||||||
|
|
||||||
if (SpNode && !thread.cutoff_occurred())
|
|
||||||
{
|
|
||||||
sp->bestValue = value;
|
|
||||||
sp->ss->bestMove = move;
|
|
||||||
sp->alpha = alpha;
|
|
||||||
sp->is_betaCutoff = (value >= beta);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (RootNode)
|
if (RootNode)
|
||||||
{
|
{
|
||||||
@@ -1216,10 +1197,6 @@ split_point_start: // At split points actual search starts from here
|
|||||||
// the best move changes frequently, we allocate some more time.
|
// the best move changes frequently, we allocate some more time.
|
||||||
if (!isPvMove && MultiPV == 1)
|
if (!isPvMove && MultiPV == 1)
|
||||||
Rml.bestMoveChanges++;
|
Rml.bestMoveChanges++;
|
||||||
|
|
||||||
// Update alpha
|
|
||||||
if (value > alpha)
|
|
||||||
alpha = value;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// All other moves but the PV are set to the lowest value, this
|
// All other moves but the PV are set to the lowest value, this
|
||||||
@@ -1229,6 +1206,25 @@ split_point_start: // At split points actual search starts from here
|
|||||||
|
|
||||||
} // RootNode
|
} // RootNode
|
||||||
|
|
||||||
|
if (value > bestValue)
|
||||||
|
{
|
||||||
|
bestValue = value;
|
||||||
|
ss->bestMove = move;
|
||||||
|
|
||||||
|
if ( PvNode
|
||||||
|
&& value > alpha
|
||||||
|
&& value < beta) // We want always alpha < beta
|
||||||
|
alpha = value;
|
||||||
|
|
||||||
|
if (SpNode && !thread.cutoff_occurred())
|
||||||
|
{
|
||||||
|
sp->bestValue = value;
|
||||||
|
sp->ss->bestMove = move;
|
||||||
|
sp->alpha = alpha;
|
||||||
|
sp->is_betaCutoff = (value >= beta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Step 19. Check for split
|
// Step 19. Check for split
|
||||||
if ( !RootNode
|
if ( !RootNode
|
||||||
&& !SpNode
|
&& !SpNode
|
||||||
|
|||||||
Reference in New Issue
Block a user