struct Skill {
Skill(int skill_level, int uci_elo) {
if (uci_elo)
- level = std::clamp(std::pow((uci_elo - 1346.6) / 143.4, 1 / 0.806), 0.0, 20.0);
+ {
+ double e = double(uci_elo - 1320) / (3190 - 1320);
+ level = std::clamp((((37.2473 * e - 40.8525) * e + 22.2943) * e - 0.311438), 0.0, 19.0);
+ }
else
level = double(skill_level);
}
int iterIdx = 0;
std::memset(ss-7, 0, 10 * sizeof(Stack));
- for (int i = 7; i > 0; i--)
+ for (int i = 7; i > 0; --i)
+ {
(ss-i)->continuationHistory = &this->continuationHistory[0][0][NO_PIECE][0]; // Use as a sentinel
+ (ss-i)->staticEval = VALUE_NONE;
+ }
for (int i = 0; i <= MAX_PLY + 2; ++i)
(ss+i)->ply = i;
// Step 18. Full depth search when LMR is skipped. If expected reduction is high, reduce its depth by 1.
else if (!PvNode || moveCount > 1)
{
+ // Increase reduction for cut nodes and not ttMove (~1 Elo)
+ if (!ttMove && cutNode)
+ r += 2;
+
value = -search<NonPV>(pos, ss+1, -(alpha+1), -alpha, newDepth - (r > 4), !cutNode);
}
else if ( (depth >= 5 || PvNode || bestValue < alpha - 65 * depth)
&& !priorCapture)
{
- //Assign extra bonus if current node is PvNode or cutNode
- //or fail low was really bad
- bool extraBonus = PvNode
- || cutNode;
-
- bool doubleExtraBonus = extraBonus && bestValue < alpha - 88 * depth;
-
- update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth) * (1 + extraBonus + doubleExtraBonus));
+ // Extra bonuses for PV/Cut nodes or bad fail lows
+ int bonus = 1 + (PvNode || cutNode) + (bestValue < alpha - 88 * depth);
+ update_continuation_histories(ss-1, pos.piece_on(prevSq), prevSq, stat_bonus(depth) * bonus);
}
if (PvNode)