}
// Evaluation function. Perform differential calculation.
- Value evaluate(const Position& pos, bool adjusted) {
+ Value evaluate(const Position& pos, bool adjusted, int* complexity) {
// We manually align the arrays on the stack because with gcc < 9.3
// overaligning stack variables with alignas() doesn't work correctly.
const auto psqt = featureTransformer->transform(pos, transformedFeatures, bucket);
const auto positional = network[bucket]->propagate(transformedFeatures);
+ if (complexity)
+ *complexity = abs(psqt - positional) / OutputScale;
+
// Give more value to positional evaluation when adjusted flag is set
if (adjusted)
- return static_cast<Value>(((128 - delta) * psqt + (128 + delta) * positional) / 128 / OutputScale);
+ return static_cast<Value>(((128 - delta) * psqt + (128 + delta) * positional) / (128 * OutputScale));
else
return static_cast<Value>((psqt + positional) / OutputScale);
}