Skip to content

Commit

Permalink
Update evaluate.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangqishare authored Oct 20, 2024
1 parent 9f7bb36 commit 9c899b6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
#include "nnue/nnue_accumulator.h"

namespace Stockfish {
int evaluate_1 = 556, evaluate_2 = 9359, evaluate_3 = 43, evaluate_4 = 480, evaluate_5 = 107, evaluate_6 = 483, evaluate_7 = 256;
TUNE(evaluate_1, evaluate_2, evaluate_3, evaluate_4, evaluate_5, evaluate_6, evaluate_7);

// Evaluate is the evaluator for the outer world. It returns a static evaluation
// of the position from the point of view of the side to move.
Expand All @@ -49,14 +51,14 @@ Value Eval::evaluate(const Eval::NNUE::Network& network,
int nnueComplexity = std::abs(psqt - positional);

// Blend optimism and eval with nnue complexity
optimism += optimism * nnueComplexity / 556;
nnue -= nnue * nnueComplexity / 9359;
optimism += optimism * nnueComplexity / (evaluate_1);
nnue -= nnue * nnueComplexity / (evaluate_2);

int mm = pos.major_material() / 43;
int v = (nnue * (480 + mm) + optimism * (107 + mm)) / 483;
int mm = pos.major_material() / (evaluate_3);
int v = (nnue * ((evaluate_4) + mm) + optimism * ((evaluate_5) + mm)) / (evaluate_6);

// Damp down the evaluation linearly when shuffling
v -= (v * pos.rule60_count()) / 256;
v -= (v * pos.rule60_count()) / (evaluate_7);

// Guarantee evaluation does not hit the mate range
v = std::clamp(v, VALUE_MATED_IN_MAX_PLY + 1, VALUE_MATE_IN_MAX_PLY - 1);
Expand Down

0 comments on commit 9c899b6

Please sign in to comment.