assert(0 < depth && depth < MAX_PLY);
assert(!(PvNode && cutNode));
- Move pv[MAX_PLY+1], capturesSearched[32], quietsSearched[64];
+ Move pv[MAX_PLY+1], capturesSearched[32], quietsSearched[32];
StateInfo st;
ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
if (move == excludedMove)
continue;
+ // Check for legality
+ if (!pos.legal(move))
+ continue;
+
// At root obey the "searchmoves" option and skip moves not listed in Root
- // Move List. As a consequence, any illegal move is also skipped. In MultiPV
- // mode we also skip PV moves that have been already searched and those
- // of lower "TB rank" if we are in a TB root position.
+ // Move List. In MultiPV mode we also skip PV moves that have been already
+ // searched and those of lower "TB rank" if we are in a TB root position.
if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->pvIdx,
thisThread->rootMoves.begin() + thisThread->pvLast, move))
continue;
- // Check for legality
- if (!rootNode && !pos.legal(move))
- continue;
-
ss->moveCount = ++moveCount;
if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000)
// If the move is worse than some previously searched move, remember it, to update its stats later
- if (move != bestMove)
+ if (move != bestMove && moveCount <= 32)
{
- if (capture && captureCount < 32)
+ if (capture)
capturesSearched[captureCount++] = move;
- else if (!capture && quietCount < 64)
+ else
quietsSearched[quietCount++] = move;
}
}
Value bestValue, value, ttValue, futilityValue, futilityBase;
bool pvHit, givesCheck, capture;
int moveCount;
+ Color us = pos.side_to_move();
// Step 1. Initialize node
if (PvNode)
moveCount++;
// Step 6. Pruning.
- if (bestValue > VALUE_TB_LOSS_IN_MAX_PLY)
+ if (bestValue > VALUE_TB_LOSS_IN_MAX_PLY && pos.non_pawn_material(us))
{
// Futility pruning and moveCount pruning (~10 Elo)
if ( !givesCheck