From: Joona Kiiski Date: Sat, 6 Aug 2011 08:15:46 +0000 (+0100) Subject: Preparations for splitting at root X-Git-Url: https://git.sesse.net/?p=stockfish;a=commitdiff_plain;h=13bc6ba2c69f326017dcc771d1e45a096e23e0c4 Preparations for splitting at root No functional change Signed-off-by: Marco Costalba --- diff --git a/src/search.cpp b/src/search.cpp index c07ba32e..0dccf934 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -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 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