Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak stand pat usage in qsearch. #4922

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1468,14 +1468,19 @@ Value qsearch(Position& pos, Stack* ss, Value alpha, Value beta, Depth depth) {
ss->staticEval = bestValue =
(ss - 1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss - 1)->staticEval;

// Stand pat. Return immediately if static value is at least beta
// Stand pat. Return immediately if bestValue is at least beta at non-Pv nodes.
// At PvNodes set bestValue between alpha and beta instead
if (bestValue >= beta)
{
if (!ss->ttHit)
tte->save(posKey, value_to_tt(bestValue, ss->ply), false, BOUND_LOWER, DEPTH_NONE,
MOVE_NONE, ss->staticEval);
if (!PvNode || abs(bestValue) >= VALUE_TB_WIN_IN_MAX_PLY)
{
if (!ss->ttHit)
tte->save(posKey, value_to_tt(bestValue, ss->ply), false, BOUND_LOWER, DEPTH_NONE,
MOVE_NONE, ss->staticEval);

return bestValue;
return bestValue;
}
bestValue = std::min((alpha + beta) / 2, beta - 1);
}

if (bestValue > alpha)
Expand Down
Loading