Skip to content

Commit

Permalink
do not redundantly evaluate when skip move
Browse files Browse the repository at this point in the history
test r15
  • Loading branch information
dhbloo committed Jun 13, 2024
1 parent fa863d2 commit ca10d84
Showing 1 changed file with 24 additions and 24 deletions.
48 changes: 24 additions & 24 deletions Rapfi/search/ab/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,35 +812,35 @@ Value search(Board &board, SearchStack *ss, Value alpha, Value beta, Depth depth
if (oppo5)
goto moves_loop;
}
else if (!RootNode) {
if (ttHit) {
// Never assume anything about values stored in TT
ss->staticEval = eval = ttEval;
if (eval == VALUE_NONE)
ss->staticEval = eval = Evaluation::evaluate<Rule>(board, alpha, beta);

// Try to use ttValue as a better eval estimation
if (ttValue != VALUE_NONE && (ttBound & (ttValue > eval ? BOUND_LOWER : BOUND_UPPER)))
eval = ttValue;
}
else {
else if (skipMove) {
eval = ss->staticEval;
}
else if (ttHit) {
// Never assume anything about values stored in TT
ss->staticEval = eval = ttEval;
if (eval == VALUE_NONE)
ss->staticEval = eval = Evaluation::evaluate<Rule>(board, alpha, beta);

// Save static evaluation into transposition table
if (!skipMove)
TT.store(posKey,
VALUE_NONE,
ss->staticEval,
ss->ttPv,
BOUND_NONE,
Pos::NONE,
(int)DEPTH_NONE,
ss->ply);
}
// Try to use ttValue as a better eval estimation
if (ttValue != VALUE_NONE && (ttBound & (ttValue > eval ? BOUND_LOWER : BOUND_UPPER)))
eval = ttValue;
}
else {
ss->staticEval = eval = Evaluation::evaluate<Rule>(board, alpha, beta);

improvement = ss->staticEval - (ss - 2)->staticEval;
// Save static evaluation into transposition table
TT.store(posKey,
VALUE_NONE,
ss->staticEval,
ss->ttPv,
BOUND_NONE,
Pos::NONE,
(int)DEPTH_NONE,
ss->ply);
}

improvement = ss->staticEval - (ss - 2)->staticEval;

// Step 7. Razoring with VCF (~55 elo)
if (!PvNode && eval + razorMargin<Rule>(depth) < alpha) {
return vcfsearch<Rule, NonPV>(board, ss, alpha, alpha + 1);
Expand Down

0 comments on commit ca10d84

Please sign in to comment.