X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=db2d933d0eaf0172b086a08c7b26512168c47ca4;hp=433129d9b5737659cacc8a9307d803a9a0e2d30d;hb=b48439e90643cb6f65f9e34d1421976883c12efc;hpb=6b9a22b40d37d27ad10cafd8697d96e90a586f8a diff --git a/src/search.cpp b/src/search.cpp index 433129d9..db2d933d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -75,7 +75,7 @@ namespace { int FutilityMoveCounts[2][16]; // [improving][depth] int Reductions[2][2][64][64]; // [pv][improving][depth][moveNumber] - // Threshold used for countermoves based pruning. + // Threshold used for countermoves based pruning const int CounterMovePruneThreshold = 0; template Depth reduction(bool i, Depth d, int mn) { @@ -195,8 +195,10 @@ void Search::clear() { th->counterMoves.clear(); th->history.clear(); th->counterMoveHistory.clear(); - th->counterMoveHistory[NO_PIECE][0].fill(CounterMovePruneThreshold-1); th->resetCalls = true; + CounterMoveStats& cm = th->counterMoveHistory[NO_PIECE][0]; + int* t = &cm[NO_PIECE][0]; + std::fill(t, t + sizeof(cm), CounterMovePruneThreshold - 1); } Threads.main()->previousScore = VALUE_INFINITE; @@ -562,9 +564,10 @@ namespace { if (thisThread->resetCalls.load(std::memory_order_relaxed)) { thisThread->resetCalls = false; + // At low node count increase the checking rate to about 0.1% of nodes // otherwise use a default value. - thisThread->callsCnt = Limits.nodes ? std::min((int64_t)4096, Limits.nodes / 1024) + thisThread->callsCnt = Limits.nodes ? std::min(4096, int(Limits.nodes / 1024)) : 4096; } @@ -889,7 +892,7 @@ moves_loop: // When in check search starts from here if (value < rBeta) extension = ONE_PLY; } - else if ( givesCheck + else if ( givesCheck && !moveCountPruning && pos.see_ge(move, VALUE_ZERO)) extension = ONE_PLY; @@ -904,10 +907,11 @@ moves_loop: // When in check search starts from here { if ( !captureOrPromotion && !givesCheck - && (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= 5000)) + && (!pos.advanced_pawn_push(move) || pos.non_pawn_material() >= Value(5000))) { // Move count based pruning - if (moveCountPruning) { + if (moveCountPruning) + { skipQuiets = true; continue; } @@ -1126,11 +1130,11 @@ moves_loop: // When in check search starts from here && is_ok((ss-1)->currentMove)) update_cm_stats(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth)); - if(!excludedMove) + if (!excludedMove) tte->save(posKey, value_to_tt(bestValue, ss->ply), - bestValue >= beta ? BOUND_LOWER : - PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, - depth, bestMove, ss->staticEval, TT.generation()); + bestValue >= beta ? BOUND_LOWER : + PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER, + depth, bestMove, ss->staticEval, TT.generation()); assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);