mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Simplify away adjustEval lambda
Now that only the shuffling constant differs between nets, a lambda for adjusting eval is no longer needed. Passed non-regression STC: https://tests.stockfishchess.org/tests/view/664806ca6dcff0d1d6b05f34 LLR: 2.99 (-2.94,2.94) <-1.75,0.25> Total: 31552 W: 8175 L: 7959 D: 15418 Ptnml(0-2): 76, 3180, 9065, 3362, 93 closes https://github.com/official-stockfish/Stockfish/pull/5260 No functional change
This commit is contained in:
parent
4edd1a389e
commit
2694fce928
1 changed files with 7 additions and 15 deletions
|
@ -72,23 +72,15 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
|
||||||
smallNet = false;
|
smallNet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto adjustEval = [&](int shufflingConstant) {
|
// Blend optimism and eval with nnue complexity and material imbalance
|
||||||
// Blend optimism and eval with nnue complexity and material imbalance
|
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / 584;
|
||||||
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / 584;
|
nnue -= nnue * (nnueComplexity * 5 / 3) / 32395;
|
||||||
nnue -= nnue * (nnueComplexity * 5 / 3) / 32395;
|
|
||||||
|
|
||||||
int npm = pos.non_pawn_material() / 64;
|
int npm = pos.non_pawn_material() / 64;
|
||||||
v = (nnue * (npm + 943 + 11 * pos.count<PAWN>()) + optimism * (npm + 140)) / 1058;
|
v = (nnue * (npm + 943 + 11 * pos.count<PAWN>()) + optimism * (npm + 140)) / 1058;
|
||||||
|
|
||||||
// Damp down the evaluation linearly when shuffling
|
// Damp down the evaluation linearly when shuffling
|
||||||
int shuffling = pos.rule50_count();
|
v = v * ((smallNet ? 206 : 178) - pos.rule50_count()) / 207;
|
||||||
v = v * (shufflingConstant - shuffling) / 207;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!smallNet)
|
|
||||||
adjustEval(178);
|
|
||||||
else
|
|
||||||
adjustEval(206);
|
|
||||||
|
|
||||||
// Guarantee evaluation does not hit the tablebase range
|
// Guarantee evaluation does not hit the tablebase range
|
||||||
v = std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);
|
v = std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);
|
||||||
|
|
Loading…
Add table
Reference in a new issue