complexityAverage.set(155, 1);
- trend = SCORE_ZERO;
- optimism[ us] = Value(37);
- optimism[~us] = -optimism[us];
+ trend = SCORE_ZERO;
+ optimism[us] = optimism[~us] = VALUE_ZERO;
int searchAgainCounter = 0;
beta = std::min(prev + delta, VALUE_INFINITE);
// Adjust trend and optimism based on root move's previousScore
- int tr = sigmoid(prev, 3, 10, 89, 116, 1);
+ int tr = 116 * prev / (std::abs(prev) + 89);
trend = (us == WHITE ? make_score(tr, tr / 2)
: -make_score(tr, tr / 2));
- int opt = sigmoid(prev, 7, 20, 169, 19350, 164);
+ int opt = 118 * prev / (std::abs(prev) + 169);
optimism[ us] = Value(opt);
optimism[~us] = -optimism[us];
}
// Step 7. Razoring.
// If eval is really low check with qsearch if it can exceed alpha, if it can't,
// return a fail low.
- if ( depth <= 7
- && eval < alpha - 369 - 254 * depth * depth)
+ if (eval < alpha - 369 - 254 * depth * depth)
{
value = qsearch<NonPV>(pos, ss, alpha - 1, alpha);
if (value < alpha)
&& depth < 8
&& eval - futility_margin(depth, improving) - (ss-1)->statScore / 303 >= beta
&& eval >= beta
- && eval < 28031) // larger than VALUE_KNOWN_WIN, but smaller than TB wins.
+ && eval < 28031) // larger than VALUE_KNOWN_WIN, but smaller than TB wins
return eval;
// Step 9. Null move search with verification search (~22 Elo)
|| givesCheck)
{
// Futility pruning for captures (~0 Elo)
- if ( !pos.empty(to_sq(move))
- && !givesCheck
+ if ( !givesCheck
&& !PvNode
&& lmrDepth < 7
&& !ss->inCheck
&& (tte->bound() & BOUND_LOWER)
&& tte->depth() >= depth - 3)
{
- Value singularBeta = ttValue - 3 * depth;
+ Value singularBeta = ttValue - (3 + (ss->ttPv && !PvNode)) * depth;
Depth singularDepth = (depth - 1) / 2;
ss->excludedMove = move;
if (singularQuietLMR)
r--;
- // Increase reduction if next ply has a lot of fail high else reset count to 0
+ // Dicrease reduction if we move a threatened piece (~1 Elo)
+ if ( depth > 9
+ && (mp.threatenedPieces & from_sq(move)))
+ r--;
+
+ // Increase reduction if next ply has a lot of fail high
if ((ss+1)->cutoffCnt > 3 && !PvNode)
r++;
// Continuation history based pruning (~2 Elo)
if ( !capture
&& bestValue > VALUE_TB_LOSS_IN_MAX_PLY
- && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold
- && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < CounterMovePruneThreshold)
+ && (*contHist[0])[pos.moved_piece(move)][to_sq(move)] < 0
+ && (*contHist[1])[pos.moved_piece(move)][to_sq(move)] < 0)
continue;
// movecount pruning for quiet check evasions
ss << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");
ss << " nodes " << nodesSearched
- << " nps " << nodesSearched * 1000 / elapsed;
-
- if (elapsed > 1000) // Earlier makes little sense
- ss << " hashfull " << TT.hashfull();
-
- ss << " tbhits " << tbHits
+ << " nps " << nodesSearched * 1000 / elapsed
+ << " hashfull " << TT.hashfull()
+ << " tbhits " << tbHits
<< " time " << elapsed
<< " pv";