Skip to content

Commit

Permalink
Eval tune
Browse files Browse the repository at this point in the history
Book: winrate 65_85
TC: 180+1.8
Total/Win/Draw/Lose: 12388 / 3050 / 6484 / 2854
PTNML: 8 / 1171 / 3645 / 1357 / 13
WinRate: 50.79%
ELO: 5.25[2.32, 8.18]
LOS: 99.98
LLR: 3.12[-2.94, 2.94]
  • Loading branch information
PikaCat-OuO committed Aug 23, 2024
1 parent eceac27 commit e2bac61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ Value Eval::evaluate(const Eval::NNUE::Network& network,
assert(!pos.checkers());

auto [psqt, positional] = network.evaluate(pos, &caches.cache);
Value nnue = (1020 * psqt + 1092 * positional) / 1194;
Value nnue = (1563 * psqt + 1633 * positional) / 1183;
int nnueComplexity = std::abs(psqt - positional);

// Blend optimism and eval with nnue complexity
optimism += optimism * nnueComplexity / 434;
nnue -= nnue * nnueComplexity / 11623;
optimism += optimism * nnueComplexity / 550;
nnue -= nnue * nnueComplexity / 10129;

int mm = pos.major_material() / 36;
int v = (nnue * (615 + mm) + optimism * (109 + mm)) / 509;
int mm = pos.major_material() / 39;
int v = (nnue * (430 + mm) + optimism * (101 + mm)) / 575;

// Evaluation grain (to get more alpha-beta cuts) with randomization (for robustness)
v = (v / 16) * 16 - 1 + (pos.key() & 0x2);

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

// 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
12 changes: 6 additions & 6 deletions src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ constexpr Value VALUE_MATE = 32000;
constexpr Value VALUE_MATE_IN_MAX_PLY = VALUE_MATE - MAX_PLY;
constexpr Value VALUE_MATED_IN_MAX_PLY = -VALUE_MATE_IN_MAX_PLY;

constexpr Value RookValue = 1213;
constexpr Value AdvisorValue = 216;
constexpr Value CannonValue = 746;
constexpr Value PawnValue = 140;
constexpr Value KnightValue = 964;
constexpr Value BishopValue = 191;
constexpr Value RookValue = 1357;
constexpr Value AdvisorValue = 213;
constexpr Value CannonValue = 861;
constexpr Value PawnValue = 149;
constexpr Value KnightValue = 980;
constexpr Value BishopValue = 186;

// clang-format off
enum PieceType {
Expand Down

0 comments on commit e2bac61

Please sign in to comment.