uint64_t perft(Position& pos, Depth depth) {
StateInfo st;
- ASSERT_ALIGNED(&st, Eval::NNUE::kCacheLineSize);
+ ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
uint64_t cnt, nodes = 0;
const bool leaf = (depth == 2);
Move pv[MAX_PLY+1], capturesSearched[32], quietsSearched[64];
StateInfo st;
- ASSERT_ALIGNED(&st, Eval::NNUE::kCacheLineSize);
+ ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
TTEntry* tte;
Key posKey;
moveCount = captureCount = quietCount = ss->moveCount = 0;
bestValue = -VALUE_INFINITE;
maxValue = VALUE_INFINITE;
- ss->distanceFromPv = (PvNode ? 0 : ss->distanceFromPv);
// Check for the available remaining time
if (thisThread == Threads.main())
{
extension = 1;
singularQuietLMR = !ttCapture;
+ if (!PvNode && value < singularBeta - 140)
+ extension = 2;
}
// Multi-cut pruning
&& (pos.is_discovered_check_on_king(~us, move) || pos.see_ge(move)))
extension = 1;
- // Last captures extension
- else if ( PieceValue[EG][pos.captured_piece()] > PawnValueEg
- && pos.non_pawn_material() <= 2 * RookValueMg)
- extension = 1;
-
// Add extension to new depth
newDepth += extension;
// Step 15. Make the move
pos.do_move(move, st, givesCheck);
- (ss+1)->distanceFromPv = ss->distanceFromPv + moveCount - 1;
-
// Step 16. Late moves reduction / extension (LMR, ~200 Elo)
// We use various heuristics for the sons of a node after the first son has
// been searched. In general we would like to reduce them, but there are many
|| ss->staticEval + PieceValue[EG][pos.captured_piece()] <= alpha
|| cutNode
|| (!PvNode && !formerPv && captureHistory[movedPiece][to_sq(move)][type_of(pos.captured_piece())] < 3678)
- || thisThread->ttHitAverage < 432 * TtHitAverageResolution * TtHitAverageWindow / 1024))
+ || thisThread->ttHitAverage < 432 * TtHitAverageResolution * TtHitAverageWindow / 1024)
+ && (!PvNode || ss->ply > 1 || thisThread->id() % 4 != 3))
{
Depth r = reduction(improving, depth, moveCount);
r -= ss->statScore / 14790;
}
- // In general we want to cap the LMR depth search at newDepth. But for nodes
- // close to the principal variation the cap is at (newDepth + 1), which will
- // allow these nodes to be searched deeper than the pv (up to 4 plies deeper).
- Depth d = std::clamp(newDepth - r, 1, newDepth + ((ss+1)->distanceFromPv <= 4));
+ // In general we want to cap the LMR depth search at newDepth. But if
+ // reductions are really negative and movecount is low, we allow this move
+ // to be searched deeper than the first move.
+ Depth d = std::clamp(newDepth - r, 1, newDepth + (r < -1 && moveCount <= 5));
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, d, true);
Move pv[MAX_PLY+1];
StateInfo st;
- ASSERT_ALIGNED(&st, Eval::NNUE::kCacheLineSize);
+ ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
TTEntry* tte;
Key posKey;
bool RootMove::extract_ponder_from_tt(Position& pos) {
StateInfo st;
- ASSERT_ALIGNED(&st, Eval::NNUE::kCacheLineSize);
+ ASSERT_ALIGNED(&st, Eval::NNUE::CacheLineSize);
bool ttHit;