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

Avoid to use nullChild

Should be a non functional change, but
for some reason bench is changed.

bench: 8454456
This commit is contained in:
Marco Costalba 2014-06-06 09:58:00 +02:00
parent 08753771fc
commit ad1167c482
2 changed files with 9 additions and 7 deletions

View file

@ -270,7 +270,6 @@ namespace {
Value bestValue, alpha, beta, delta; Value bestValue, alpha, beta, delta;
std::memset(ss-2, 0, 5 * sizeof(Stack)); std::memset(ss-2, 0, 5 * sizeof(Stack));
(ss-1)->currentMove = MOVE_NULL; // Hack to skip update gains
depth = 0; depth = 0;
BestMoveChanges = 0; BestMoveChanges = 0;
@ -470,7 +469,7 @@ namespace {
bestValue = -VALUE_INFINITE; bestValue = -VALUE_INFINITE;
ss->currentMove = ss->ttMove = (ss+1)->excludedMove = bestMove = MOVE_NONE; ss->currentMove = ss->ttMove = (ss+1)->excludedMove = bestMove = MOVE_NONE;
ss->ply = (ss-1)->ply + 1; ss->ply = (ss-1)->ply + 1;
(ss+1)->skipNullMove = (ss+1)->nullChild = false; (ss+1)->reduction = DEPTH_ZERO; (ss+1)->skipNullMove = false; (ss+1)->reduction = DEPTH_ZERO;
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE; (ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
// Used to send selDepth info to GUI // Used to send selDepth info to GUI
@ -545,7 +544,9 @@ namespace {
} }
else else
{ {
eval = ss->staticEval = ss->nullChild ? -(ss-1)->staticEval + 2 * Eval::Tempo : evaluate(pos); eval = ss->staticEval =
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss-1)->staticEval + 2 * Eval::Tempo;
TT.store(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval); TT.store(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval);
} }
@ -553,6 +554,7 @@ namespace {
&& ss->staticEval != VALUE_NONE && ss->staticEval != VALUE_NONE
&& (ss-1)->staticEval != VALUE_NONE && (ss-1)->staticEval != VALUE_NONE
&& (move = (ss-1)->currentMove) != MOVE_NULL && (move = (ss-1)->currentMove) != MOVE_NULL
&& move != MOVE_NONE
&& type_of(move) == NORMAL) && type_of(move) == NORMAL)
{ {
Square to = to_sq(move); Square to = to_sq(move);
@ -605,10 +607,10 @@ namespace {
+ int(eval - beta) / PawnValueMg * ONE_PLY; + int(eval - beta) / PawnValueMg * ONE_PLY;
pos.do_null_move(st); pos.do_null_move(st);
(ss+1)->skipNullMove = (ss+1)->nullChild = true; (ss+1)->skipNullMove = true;
nullValue = depth-R < ONE_PLY ? -qsearch<NonPV, false>(pos, ss+1, -beta, -beta+1, DEPTH_ZERO) nullValue = depth-R < ONE_PLY ? -qsearch<NonPV, false>(pos, ss+1, -beta, -beta+1, DEPTH_ZERO)
: - search<NonPV, false>(pos, ss+1, -beta, -beta+1, depth-R, !cutNode); : - search<NonPV, false>(pos, ss+1, -beta, -beta+1, depth-R, !cutNode);
(ss+1)->skipNullMove = (ss+1)->nullChild = false; (ss+1)->skipNullMove = false;
pos.undo_null_move(); pos.undo_null_move();
if (nullValue >= beta) if (nullValue >= beta)
@ -1108,7 +1110,8 @@ moves_loop: // When in check and at SpNode search starts from here
bestValue = ttValue; bestValue = ttValue;
} }
else else
ss->staticEval = bestValue = ss->nullChild ? -(ss-1)->staticEval + 2 * Eval::Tempo : evaluate(pos); ss->staticEval = bestValue =
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss-1)->staticEval + 2 * Eval::Tempo;
// Stand pat. Return immediately if static value is at least beta // Stand pat. Return immediately if static value is at least beta
if (bestValue >= beta) if (bestValue >= beta)

View file

@ -46,7 +46,6 @@ struct Stack {
Depth reduction; Depth reduction;
Value staticEval; Value staticEval;
bool skipNullMove; bool skipNullMove;
bool nullChild;
}; };