- // If result of a classical evaluation is much lower than threshold fall back to NNUE
- if (useNNUE && !useClassical)
- {
- int complexity;
- int scale = 1048 + 109 * pos.non_pawn_material() / 5120;
- Color stm = pos.side_to_move();
- Value optimism = pos.this_thread()->optimism[stm];
- Value psq = (stm == WHITE ? 1 : -1) * eg_value(pos.psq_score());
- Value nnue = NNUE::evaluate(pos, true, &complexity); // NNUE
-
- complexity = (137 * complexity + 137 * abs(nnue - psq)) / 256;
- optimism = optimism * (255 + complexity) / 256;
- v = (nnue * scale + optimism * (scale - 848)) / 1024;
-
- if (pos.is_chess960())
- v += fix_FRC(pos);
+ optimism = optimism * (269 + nnueComplexity) / 256;
+ v = (nnue * scale + optimism * (scale - 754)) / 1024;