Color RootColor;
Time::point SearchTime;
StateStackPtr SetupStates;
- MovesVectPtr SetupMoves;
}
using std::string;
Stack ss[MAX_PLY_PLUS_2];
int depth, prevBestMoveChanges;
Value bestValue, alpha, beta, delta;
- bool bestMoveNeverChanged = true;
memset(ss, 0, 4 * sizeof(Stack));
depth = BestMoveChanges = 0;
<< std::endl;
}
- // Filter out startup noise when monitoring best move stability
- if (depth > 2 && BestMoveChanges)
- bestMoveNeverChanged = false;
-
// Do we have found a "mate in x"?
if ( Limits.mate
&& bestValue >= VALUE_MATE_IN_MAX_PLY
if (Time::now() - SearchTime > (TimeMgr.available_time() * 62) / 100)
stop = true;
- bool recapture = pos.is_capture(RootMoves[0].pv[0])
- && pos.captured_piece_type()
- && SetupMoves->size()
- && to_sq(SetupMoves->back()) == to_sq(RootMoves[0].pv[0]);
-
// Stop search early if one move seems to be much better than others
if ( depth >= 12
&& !stop
&& PVSize == 1
- && ( (bestMoveNeverChanged && recapture)
- || RootMoves.size() == 1
- || Time::now() - SearchTime > (TimeMgr.available_time() * 40) / 100))
+ && ( RootMoves.size() == 1
+ || Time::now() - SearchTime > (TimeMgr.available_time() * 20) / 100))
{
Value rBeta = bestValue - 2 * PawnValueMg;
(ss+1)->excludedMove = RootMoves[0].pv[0];
newDepth = depth - ONE_PLY + ext;
// Step 13. Futility pruning (is omitted in PV nodes)
- if ( !captureOrPromotion
+ if ( !PvNode
+ && !captureOrPromotion
&& !inCheck
&& !dangerous
&& move != ttMove)
{
// Move count based pruning
- if ( !PvNode
- && depth < 16 * ONE_PLY
+ if ( depth < 16 * ONE_PLY
&& moveCount >= FutilityMoveCounts[depth]
&& (!threatMove || !refutes(pos, move, threatMove)))
{
futilityValue = ss->staticEval + ss->evalMargin + futility_margin(predictedDepth, moveCount)
+ Gain[pos.piece_moved(move)][to_sq(move)];
- if (!PvNode && futilityValue < beta)
+ if (futilityValue < beta)
{
if (SpNode)
splitPoint->mutex.lock();
}
// Prune moves with negative SEE at low depths
- if ( predictedDepth < 2 * ONE_PLY
+ if ( predictedDepth < 3 * ONE_PLY
&& pos.see_sign(move) < 0)
{
if (SpNode)