1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Reset bestMove before entering main moves loop

After razoring, IID, null verification and singular
extension searches we have could have a dirty ss->bestMove,
restore to MOVE_NONE before to enter moves loop.

This should avoid to store in TT a stale move when
we fail low.

Tested together with previous patch that is the
one that gives ELO.

After 1152 games at 1+0 on my QUAD
Mod vs Orig +233 =716 -203 (+9 ELO)

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2010-08-01 09:37:07 +01:00
parent cbcc581a86
commit 5aef9186ac

View file

@ -1051,6 +1051,7 @@ namespace {
if (tte) if (tte)
{ {
assert(tte->static_value() != VALUE_NONE); assert(tte->static_value() != VALUE_NONE);
ss->eval = tte->static_value(); ss->eval = tte->static_value();
ei.kingDanger[pos.side_to_move()] = tte->king_danger(); ei.kingDanger[pos.side_to_move()] = tte->king_danger();
} }
@ -1059,7 +1060,6 @@ namespace {
ss->eval = evaluate(pos, ei); ss->eval = evaluate(pos, ei);
TT.store(posKey, VALUE_NONE, VALUE_TYPE_NONE, DEPTH_NONE, MOVE_NONE, ss->eval, ei.kingDanger[pos.side_to_move()]); TT.store(posKey, VALUE_NONE, VALUE_TYPE_NONE, DEPTH_NONE, MOVE_NONE, ss->eval, ei.kingDanger[pos.side_to_move()]);
} }
refinedValue = refine_eval(tte, ss->eval, ply); // Enhance accuracy with TT value if possible refinedValue = refine_eval(tte, ss->eval, ply); // Enhance accuracy with TT value if possible
update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval); update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval);
} }
@ -1183,9 +1183,11 @@ namespace {
// Initialize a MovePicker object for the current position // Initialize a MovePicker object for the current position
MovePicker mp = MovePicker(pos, ttMove, depth, H, ss, (PvNode ? -VALUE_INFINITE : beta)); MovePicker mp = MovePicker(pos, ttMove, depth, H, ss, (PvNode ? -VALUE_INFINITE : beta));
CheckInfo ci(pos); CheckInfo ci(pos);
ss->bestMove = MOVE_NONE;
singleEvasion = isCheck && mp.number_of_evasions() == 1; singleEvasion = isCheck && mp.number_of_evasions() == 1;
singularExtensionNode = depth >= SingularExtensionDepth[PvNode] singularExtensionNode = depth >= SingularExtensionDepth[PvNode]
&& tte && tte->move() && tte
&& tte->move()
&& !excludedMove // Do not allow recursive singular extension search && !excludedMove // Do not allow recursive singular extension search
&& is_lower_bound(tte->type()) && is_lower_bound(tte->type())
&& tte->depth() >= depth - 3 * OnePly; && tte->depth() >= depth - 3 * OnePly;
@ -1238,6 +1240,7 @@ namespace {
Value v = search<NonPV>(pos, ss, b - 1, b, depth / 2, ply); Value v = search<NonPV>(pos, ss, b - 1, b, depth / 2, ply);
ss->skipNullMove = false; ss->skipNullMove = false;
ss->excludedMove = MOVE_NONE; ss->excludedMove = MOVE_NONE;
ss->bestMove = MOVE_NONE;
if (v < b) if (v < b)
ext = OnePly; ext = OnePly;
} }