X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=c80a064dfde82ba15f1eb98550d9eda5ebf11107;hp=35160b9665a39d6ed99bae69da65940ebf9f049b;hb=239d7b3fd144d2b493bb47ea97a436cec8ae5990;hpb=47f988f05fb86b0cd9187885b1cfa942addbeee6 diff --git a/src/search.cpp b/src/search.cpp index 35160b96..c80a064d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -62,10 +62,6 @@ namespace { // Different node types, used as template parameter enum NodeType { Root, PV, NonPV, SplitPointRoot, SplitPointPV, SplitPointNonPV }; - // Lookup table to check if a Piece is a slider and its access function - const bool Slidings[18] = { 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1 }; - inline bool piece_is_slider(Piece p) { return Slidings[p]; } - // Dynamic razoring margin based on depth inline Value razor_margin(Depth d) { return Value(512 + 16 * int(d)); } @@ -222,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] @@ -1020,8 +1016,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) @@ -1101,12 +1101,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) @@ -1144,7 +1149,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); @@ -1192,6 +1202,7 @@ split_point_start: // At split points actual search starts from here if ( !PvNode && !InCheck && !givesCheck + && !fromNull && move != ttMove && enoughMaterial && type_of(move) != PROMOTION @@ -1284,7 +1295,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); @@ -1437,10 +1448,8 @@ split_point_start: // At split points actual search starts from here return true; } - // If the threat piece is a slider, don't prune safe moves which block it - if ( piece_is_slider(pos.piece_on(tfrom)) - && (between_bb(tfrom, tto) & mto) - && pos.see_sign(move) >= 0) + // Don't prune safe moves which block the threat path + if ((between_bb(tfrom, tto) & mto) && pos.see_sign(move) >= 0) return true; return false;