Skip to content

Commit 7f56d29

Browse files
committed
Avoid to use nullChild
Use instead: (ss-1)->currentMove == MOVE_NULL No functional change.
1 parent d10ae90 commit 7f56d29

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/search.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ namespace {
469469
bestValue = -VALUE_INFINITE;
470470
ss->currentMove = ss->ttMove = (ss+1)->excludedMove = bestMove = MOVE_NONE;
471471
ss->ply = (ss-1)->ply + 1;
472-
(ss+1)->skipNullMove = (ss+1)->nullChild = false; (ss+1)->reduction = DEPTH_ZERO;
472+
(ss+1)->skipNullMove = false; (ss+1)->reduction = DEPTH_ZERO;
473473
(ss+2)->killers[0] = (ss+2)->killers[1] = MOVE_NONE;
474474

475475
// Used to send selDepth info to GUI
@@ -544,7 +544,9 @@ namespace {
544544
}
545545
else
546546
{
547-
eval = ss->staticEval = ss->nullChild ? -(ss-1)->staticEval + 2 * Eval::Tempo : evaluate(pos);
547+
eval = ss->staticEval =
548+
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss-1)->staticEval + 2 * Eval::Tempo;
549+
548550
TT.store(posKey, VALUE_NONE, BOUND_NONE, DEPTH_NONE, MOVE_NONE, ss->staticEval);
549551
}
550552

@@ -605,10 +607,10 @@ namespace {
605607
+ int(eval - beta) / PawnValueMg * ONE_PLY;
606608

607609
pos.do_null_move(st);
608-
(ss+1)->skipNullMove = (ss+1)->nullChild = true;
610+
(ss+1)->skipNullMove = true;
609611
nullValue = depth-R < ONE_PLY ? -qsearch<NonPV, false>(pos, ss+1, -beta, -beta+1, DEPTH_ZERO)
610612
: - search<NonPV, false>(pos, ss+1, -beta, -beta+1, depth-R, !cutNode);
611-
(ss+1)->skipNullMove = (ss+1)->nullChild = false;
613+
(ss+1)->skipNullMove = false;
612614
pos.undo_null_move();
613615

614616
if (nullValue >= beta)
@@ -1108,7 +1110,8 @@ namespace {
11081110
bestValue = ttValue;
11091111
}
11101112
else
1111-
ss->staticEval = bestValue = ss->nullChild ? -(ss-1)->staticEval + 2 * Eval::Tempo : evaluate(pos);
1113+
ss->staticEval = bestValue =
1114+
(ss-1)->currentMove != MOVE_NULL ? evaluate(pos) : -(ss-1)->staticEval + 2 * Eval::Tempo;
11121115

11131116
// Stand pat. Return immediately if static value is at least beta
11141117
if (bestValue >= beta)

src/search.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct Stack {
4646
Depth reduction;
4747
Value staticEval;
4848
bool skipNullMove;
49-
bool nullChild;
5049
};
5150

5251

0 commit comments

Comments
 (0)