Skip to content

Commit

Permalink
bench: 1281840
Browse files Browse the repository at this point in the history
  • Loading branch information
Taras Vuk committed Sep 11, 2024
1 parent f677aee commit 5a07e89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
12 changes: 5 additions & 7 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ Value Search::Worker::search(
// Step 9. Null move search with verification search (~35 Elo)
if (cutNode && (ss - 1)->currentMove != Move::null() && eval >= beta
&& ss->staticEval >= beta - 21 * depth + 390 && !excludedMove && pos.non_pawn_material(us)
&& ss->ply >= thisThread->nmpMinPly && beta > VALUE_TB_LOSS_IN_MAX_PLY)
&& beta > VALUE_TB_LOSS_IN_MAX_PLY)
{
assert(eval - beta >= 0);

Expand All @@ -794,18 +794,16 @@ Value Search::Worker::search(
// Do not return unproven mate or TB scores
if (nullValue >= beta && nullValue < VALUE_TB_WIN_IN_MAX_PLY)
{
if (thisThread->nmpMinPly || depth < 16)
if (thisThread->verification || depth < 16)
return nullValue;

assert(!thisThread->nmpMinPly); // Recursive verification is not allowed
assert(!thisThread->verification); // Recursive verification is not allowed

// Do verification search at high depths, with null move pruning disabled
// until ply exceeds nmpMinPly.
thisThread->nmpMinPly = ss->ply + 3 * (depth - R) / 4;
thisThread->verification = true;

Value v = search<NonPV>(pos, ss, beta - 1, beta, depth - R, false);

thisThread->nmpMinPly = 0;
thisThread->verification = false;

if (v >= beta)
return nullValue;
Expand Down
3 changes: 2 additions & 1 deletion src/search.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ class Worker {

size_t pvIdx, pvLast;
std::atomic<uint64_t> nodes, tbHits, bestMoveChanges;
int selDepth, nmpMinPly;
int selDepth;
bool verification;

Value optimism[COLOR_NB];

Expand Down
4 changes: 2 additions & 2 deletions src/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ void ThreadPool::start_thinking(const OptionsMap& options,
{
th->run_custom_job([&]() {
th->worker->limits = limits;
th->worker->nodes = th->worker->tbHits = th->worker->nmpMinPly =
th->worker->bestMoveChanges = 0;
th->worker->nodes = th->worker->tbHits = th->worker->bestMoveChanges = 0;
th->worker->verification = false;
th->worker->rootDepth = th->worker->completedDepth = 0;
th->worker->rootMoves = rootMoves;
th->worker->rootPos.set(pos.fen(), pos.is_chess960(), &th->worker->rootState);
Expand Down

0 comments on commit 5a07e89

Please sign in to comment.