// Reduction lookup tables (initialized at startup) and their access function
int8_t Reductions[2][64][64]; // [pv][depth][moveNumber]
// Reduction lookup tables (initialized at startup) and their access function
int8_t Reductions[2][64][64]; // [pv][depth][moveNumber]
Position& pos = RootPosition;
Chess960 = pos.is_chess960();
Eval::RootColor = pos.side_to_move();
Position& pos = RootPosition;
Chess960 = pos.is_chess960();
Eval::RootColor = pos.side_to_move();
{
// Step 2. Check for aborted search and immediate draw
if (Signals.stop || pos.is_draw<false>() || ss->ply > MAX_PLY)
{
// Step 2. Check for aborted search and immediate draw
if (Signals.stop || pos.is_draw<false>() || ss->ply > MAX_PLY)
// Step 3. Mate distance pruning. Even if we mate at the next move our score
// would be at best mate_in(ss->ply+1), but if alpha is already bigger because
// Step 3. Mate distance pruning. Even if we mate at the next move our score
// would be at best mate_in(ss->ply+1), but if alpha is already bigger because
// Step 11. Loop through moves
// Loop through all pseudo-legal moves until no moves remain or a beta cutoff occurs
// Step 11. Loop through moves
// Loop through all pseudo-legal moves until no moves remain or a beta cutoff occurs
- alpha = bestValue; // Update alpha here! Always alpha < beta
- }
-
- if (SpNode)
- {
- sp->bestValue = bestValue;
- sp->bestMove = bestMove;
- sp->alpha = alpha;
-
- if (bestValue >= beta)
- sp->cutoff = true;
+ {
+ alpha = value; // Update alpha here! Always alpha < beta
+ if (SpNode) sp->alpha = alpha;
+ }
+ else // Fail high
+ {
+ if (SpNode) sp->cutoff = true;
+ break;
+ }
bestValue = Threads.split<FakeSplit>(pos, ss, alpha, beta, bestValue, &bestMove,
depth, threatMove, moveCount, mp, NT);
bestValue = Threads.split<FakeSplit>(pos, ss, alpha, beta, bestValue, &bestMove,
depth, threatMove, moveCount, mp, NT);
// Decide whether or not to include checks, this fixes also the type of
// TT entry depth that we are going to use. Note that in qsearch we use
// Decide whether or not to include checks, this fixes also the type of
// TT entry depth that we are going to use. Note that in qsearch we use