Depth PassedPawnExtension[2], PawnEndgameExtension[2], MateThreatExtension[2];
// Minimum depth for use of singular extension
- const Depth SingularExtensionDepth[2] = { 8 * OnePly /* non-PV */, 6 * OnePly /* PV */};
+ const Depth SingularExtensionDepth[2] = { 7 * OnePly /* non-PV */, 6 * OnePly /* PV */};
// If the TT move is at least SingularExtensionMargin better then the
// remaining ones we will extend it.
// Refresh tte entry to avoid aging
TT.store(posKey, tte->value(), tte->type(), tte->depth(), ttMove, tte->static_value(), tte->king_danger());
- ss->currentMove = ttMove; // Can be MOVE_NONE
+ ss->bestMove = ttMove; // Can be MOVE_NONE
return value_from_tt(tte->value(), ply);
}
if (nullValue == value_mated_in(ply + 2))
mateThreat = true;
- threatMove = (ss+1)->currentMove;
+ threatMove = (ss+1)->bestMove;
if ( depth < ThreatDepth
&& (ss-1)->reduction
&& connected_moves(pos, (ss-1)->currentMove, threatMove))
&& is_lower_bound(tte->type())
&& tte->depth() >= depth - 3 * OnePly;
+ // Avoid to do an expensive singular extension search on nodes where
+ // such search had already failed in the past.
+ if ( !PvNode
+ && singularExtensionNode
+ && depth < SingularExtensionDepth[PvNode] + 5 * OnePly)
+ {
+ TTEntry* ttx = TT.retrieve(pos.get_exclusion_key());
+ if (ttx && is_lower_bound(ttx->type()))
+ singularExtensionNode = false;
+ }
+
// Step 10. Loop through moves
// Loop through all legal moves until no moves remain or a beta cutoff occurs
while ( bestValue < beta
if (!PvNode && tte && ok_to_use_TT(tte, depth, beta, ply))
{
- ss->currentMove = ttMove; // Can be MOVE_NONE
+ ss->bestMove = ttMove; // Can be MOVE_NONE
return value_from_tt(tte->value(), ply);
}
#endif
// Initialize global locks
- lock_init(&MPLock, NULL);
- lock_init(&WaitLock, NULL);
+ lock_init(&MPLock);
+ lock_init(&WaitLock);
#if !defined(_MSC_VER)
pthread_cond_init(&WaitCond, NULL);
// Initialize splitPoints[] locks
for (i = 0; i < MAX_THREADS; i++)
for (int j = 0; j < MAX_ACTIVE_SPLIT_POINTS; j++)
- lock_init(&(threads[i].splitPoints[j].lock), NULL);
+ lock_init(&(threads[i].splitPoints[j].lock));
// Will be set just before program exits to properly end the threads
AllThreadsShouldExit = false;