mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 00:33:09 +00:00
Preparations for splitting at root
No functional change Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
30b3edf328
commit
13bc6ba2c6
1 changed files with 25 additions and 29 deletions
|
@ -49,7 +49,7 @@ namespace {
|
|||
const bool FakeSplit = false;
|
||||
|
||||
// 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
|
||||
// move, we store a score, a node count, and a PV (really a refutation
|
||||
|
@ -693,9 +693,9 @@ namespace {
|
|||
template <NodeType NT>
|
||||
Value search(Position& pos, SearchStack* ss, Value alpha, Value beta, Depth depth) {
|
||||
|
||||
const bool PvNode = (NT == PV || NT == Root || NT == SplitPointPV);
|
||||
const bool SpNode = (NT == SplitPointPV || NT == SplitPointNonPV);
|
||||
const bool RootNode = (NT == Root);
|
||||
const bool PvNode = (NT == PV || NT == Root || NT == SplitPointPV || NT == SplitPointRoot);
|
||||
const bool SpNode = (NT == SplitPointPV || NT == SplitPointNonPV || NT == SplitPointRoot);
|
||||
const bool RootNode = (NT == Root || NT == SplitPointRoot);
|
||||
|
||||
assert(alpha >= -VALUE_INFINITE && alpha <= 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
|
||||
// correct accumulated node counts searched by each thread.
|
||||
if (SendSearchedNodes)
|
||||
if (!SpNode && SendSearchedNodes)
|
||||
{
|
||||
SendSearchedNodes = false;
|
||||
cout << "info" << speed_to_uci(pos.nodes_searched()) << endl;
|
||||
}
|
||||
|
||||
// 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)
|
||||
<< " currmove " << move
|
||||
<< " currmovenumber " << moveCount + MultiPVIteration << endl;
|
||||
|
@ -1170,25 +1170,6 @@ split_point_start: // At split points actual search starts from here
|
|||
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)
|
||||
{
|
||||
|
@ -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.
|
||||
if (!isPvMove && MultiPV == 1)
|
||||
Rml.bestMoveChanges++;
|
||||
|
||||
// Update alpha
|
||||
if (value > alpha)
|
||||
alpha = value;
|
||||
}
|
||||
else
|
||||
// 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
|
||||
|
||||
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
|
||||
if ( !RootNode
|
||||
&& !SpNode
|
||||
|
|
Loading…
Add table
Reference in a new issue