X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=6d332c5ecc24fd867654679ae070267abf07d899;hp=03d05796ae69bd2df092183764604e9ac7f1d85d;hb=55df3fa2d7631ed67e46f9433aa7f3a71c18e5e7;hpb=dd5b3086f5f10819c527aa6276ca7a0c54e47900 diff --git a/src/search.cpp b/src/search.cpp index 03d05796..6d332c5e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -218,7 +218,7 @@ void Search::think() { if (Options["Use Search Log"]) { Log log(Options["Search Log Filename"]); - log << "\nSearching: " << RootPos.to_fen() + log << "\nSearching: " << RootPos.fen() << "\ninfinite: " << Limits.infinite << " ponder: " << Limits.ponder << " time: " << Limits.time[RootColor] @@ -391,7 +391,8 @@ namespace { // Sort the PV lines searched so far and update the GUI sort(RootMoves.begin(), RootMoves.begin() + PVIdx + 1); - sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl; + if (PVIdx + 1 == PVSize || Time::now() - SearchTime > 3000) + sync_cout << uci_pv(pos, depth, alpha, beta) << sync_endl; } // Do we need to pick now the sub-optimal best move ? @@ -793,7 +794,7 @@ split_point_start: // At split points actual search starts from here { Signals.firstRootMove = (moveCount == 1); - if (thisThread == Threads.main_thread() && Time::now() - SearchTime > 2000) + if (thisThread == Threads.main_thread() && Time::now() - SearchTime > 3000) sync_cout << "info depth " << depth / ONE_PLY << " currmove " << move_to_uci(move, pos.is_chess960()) << " currmovenumber " << moveCount + PVIdx << sync_endl; @@ -1003,8 +1004,10 @@ split_point_start: // At split points actual search starts from here alpha = value; // Update alpha here! Always alpha < beta if (SpNode) sp->alpha = value; } - else // Fail high + else { + assert(value >= beta); // Fail high + if (SpNode) sp->cutoff = true; break; } @@ -1016,8 +1019,12 @@ split_point_start: // At split points actual search starts from here && depth >= Threads.min_split_depth() && bestValue < beta && Threads.available_slave_exists(thisThread)) + { bestValue = Threads.split(pos, ss, alpha, beta, bestValue, &bestMove, depth, threatMove, moveCount, mp, NT); + if (bestValue >= beta) + break; + } } if (SpNode) @@ -1097,12 +1104,17 @@ split_point_start: // At split points actual search starts from here const TTEntry* tte; Key posKey; Move ttMove, move, bestMove; - Value bestValue, value, ttValue, futilityValue, futilityBase; - bool givesCheck, enoughMaterial, evasionPrunable; + Value bestValue, value, ttValue, futilityValue, futilityBase, oldAlpha; + bool givesCheck, enoughMaterial, evasionPrunable, fromNull; Depth ttDepth; + // To flag BOUND_EXACT a node with eval above alpha and no available moves + if (PvNode) + oldAlpha = alpha; + ss->currentMove = bestMove = MOVE_NONE; ss->ply = (ss-1)->ply + 1; + fromNull = (ss-1)->currentMove == MOVE_NULL; // Check for an instant draw or maximum ply reached if (pos.is_draw() || ss->ply > MAX_PLY) @@ -1140,7 +1152,12 @@ split_point_start: // At split points actual search starts from here } else { - if (tte) + if (fromNull) + { + ss->staticEval = bestValue = -(ss-1)->staticEval; + ss->evalMargin = VALUE_ZERO; + } + else if (tte) { assert(tte->static_value() != VALUE_NONE || Threads.size() > 1); @@ -1188,6 +1205,7 @@ split_point_start: // At split points actual search starts from here if ( !PvNode && !InCheck && !givesCheck + && !fromNull && move != ttMove && enoughMaterial && type_of(move) != PROMOTION @@ -1280,7 +1298,7 @@ split_point_start: // At split points actual search starts from here return mated_in(ss->ply); // Plies to mate from the root TT.store(posKey, value_to_tt(bestValue, ss->ply), - PvNode && bestMove != MOVE_NONE ? BOUND_EXACT : BOUND_UPPER, + PvNode && bestValue > oldAlpha ? BOUND_EXACT : BOUND_UPPER, ttDepth, bestMove, ss->staticEval, ss->evalMargin); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);