mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Retire pvMove in search()
Now we can directly replace it with the definition resulting in simpler and possibly faster code because PvNode is evaluated at compile time. No functional change.
This commit is contained in:
parent
57fdfdedcf
commit
1b0df1ae14
1 changed files with 5 additions and 6 deletions
|
@ -407,7 +407,7 @@ namespace {
|
||||||
Move ttMove, move, excludedMove, bestMove;
|
Move ttMove, move, excludedMove, bestMove;
|
||||||
Depth ext, newDepth, predictedDepth;
|
Depth ext, newDepth, predictedDepth;
|
||||||
Value bestValue, value, ttValue, eval, nullValue, futilityValue;
|
Value bestValue, value, ttValue, eval, nullValue, futilityValue;
|
||||||
bool inCheck, givesCheck, pvMove, singularExtensionNode, improving;
|
bool inCheck, givesCheck, singularExtensionNode, improving;
|
||||||
bool captureOrPromotion, dangerous, doFullDepthSearch;
|
bool captureOrPromotion, dangerous, doFullDepthSearch;
|
||||||
int moveCount, quietCount;
|
int moveCount, quietCount;
|
||||||
|
|
||||||
|
@ -802,7 +802,6 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
pvMove = PvNode && moveCount == 1;
|
|
||||||
ss->currentMove = move;
|
ss->currentMove = move;
|
||||||
if (!SpNode && !captureOrPromotion && quietCount < 64)
|
if (!SpNode && !captureOrPromotion && quietCount < 64)
|
||||||
quietsSearched[quietCount++] = move;
|
quietsSearched[quietCount++] = move;
|
||||||
|
@ -851,7 +850,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
ss->reduction = DEPTH_ZERO;
|
ss->reduction = DEPTH_ZERO;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
doFullDepthSearch = !pvMove;
|
doFullDepthSearch = !PvNode || moveCount > 1;
|
||||||
|
|
||||||
// Step 16. Full depth search, when LMR is skipped or fails high
|
// Step 16. Full depth search, when LMR is skipped or fails high
|
||||||
if (doFullDepthSearch)
|
if (doFullDepthSearch)
|
||||||
|
@ -868,7 +867,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
// For PV nodes only, do a full PV search on the first move or after a fail
|
// For PV nodes only, do a full PV search on the first move or after a fail
|
||||||
// high (in the latter case search only if value < beta), otherwise let the
|
// high (in the latter case search only if value < beta), otherwise let the
|
||||||
// parent node fail low with value <= alpha and to try another move.
|
// parent node fail low with value <= alpha and to try another move.
|
||||||
if (PvNode && (pvMove || (value > alpha && (RootNode || value < beta))))
|
if (PvNode && (moveCount == 1 || (value > alpha && (RootNode || value < beta))))
|
||||||
value = newDepth < ONE_PLY ?
|
value = newDepth < ONE_PLY ?
|
||||||
givesCheck ? -qsearch<PV, true>(pos, ss+1, -beta, -alpha, DEPTH_ZERO)
|
givesCheck ? -qsearch<PV, true>(pos, ss+1, -beta, -alpha, DEPTH_ZERO)
|
||||||
: -qsearch<PV, false>(pos, ss+1, -beta, -alpha, DEPTH_ZERO)
|
: -qsearch<PV, false>(pos, ss+1, -beta, -alpha, DEPTH_ZERO)
|
||||||
|
@ -897,7 +896,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
RootMove& rm = *std::find(RootMoves.begin(), RootMoves.end(), move);
|
RootMove& rm = *std::find(RootMoves.begin(), RootMoves.end(), move);
|
||||||
|
|
||||||
// PV move or new best move ?
|
// PV move or new best move ?
|
||||||
if (pvMove || value > alpha)
|
if (moveCount == 1 || value > alpha)
|
||||||
{
|
{
|
||||||
rm.score = value;
|
rm.score = value;
|
||||||
rm.extract_pv_from_tt(pos);
|
rm.extract_pv_from_tt(pos);
|
||||||
|
@ -905,7 +904,7 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||||
// We record how often the best move has been changed in each
|
// We record how often the best move has been changed in each
|
||||||
// iteration. This information is used for time management: When
|
// iteration. This information is used for time management: When
|
||||||
// the best move changes frequently, we allocate some more time.
|
// the best move changes frequently, we allocate some more time.
|
||||||
if (!pvMove)
|
if (moveCount > 1)
|
||||||
++BestMoveChanges;
|
++BestMoveChanges;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue