- int nnueComplexity;
- int scale = 1064 + 106 * pos.non_pawn_material() / 5120;
- Value optimism = pos.this_thread()->optimism[stm];
-
- Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);
- // Blend nnue complexity with (semi)classical complexity
- nnueComplexity = (104 * nnueComplexity + 131 * abs(nnue - psq)) / 256;
- if (complexity) // Return hybrid NNUE complexity to caller
- *complexity = nnueComplexity;
-
- optimism = optimism * (269 + nnueComplexity) / 256;
- v = (nnue * scale + optimism * (scale - 754)) / 1024;
+ int nnueComplexity;
+ int scale = 1076 + 96 * pos.non_pawn_material() / 5120;
+
+ Color stm = pos.side_to_move();
+ Value optimism = pos.this_thread()->optimism[stm];
+
+ Value nnue = NNUE::evaluate(pos, true, &nnueComplexity);
+
+ // Blend nnue complexity with (semi)classical complexity
+ nnueComplexity = ( 406 * nnueComplexity
+ + (424 + optimism) * abs(psq - nnue)
+ ) / 1024;
+
+ // Return hybrid NNUE complexity to caller
+ if (complexity)
+ *complexity = nnueComplexity;
+
+ optimism = optimism * (272 + nnueComplexity) / 256;
+ v = (nnue * scale + optimism * (scale - 748)) / 1024;