MemoryBuffer buffer(const_cast<char*>(reinterpret_cast<const char*>(gEmbeddedNNUEData)),
size_t(gEmbeddedNNUESize));
+ (void) gEmbeddedNNUEEnd; // Silence warning on unused variable
istream stream(&buffer);
if (load_eval(eval_file, stream))
// BishopPawns[distance from edge] contains a file-dependent penalty for pawns on
// squares of the same color as our bishop.
constexpr Score BishopPawns[int(FILE_NB) / 2] = {
- S(3, 8), S(3, 9), S(2, 8), S(3, 8)
+ S(3, 8), S(3, 9), S(2, 7), S(3, 7)
};
// KingProtector[knight/bishop] contains penalty for each distance unit to own king
- constexpr Score KingProtector[] = { S(8, 9), S(6, 9) };
+ constexpr Score KingProtector[] = { S(9, 9), S(7, 9) };
// Outpost[knight/bishop] contains bonuses for each knight or bishop occupying a
// pawn protected square on rank 4 to 6 which is also safe from a pawn attack.
- constexpr Score Outpost[] = { S(57, 38), S(31, 24) };
+ constexpr Score Outpost[] = { S(54, 34), S(31, 25) };
// PassedRank[Rank] contains a bonus according to the rank of a passed pawn
constexpr Score PassedRank[RANK_NB] = {
- S(0, 0), S(7, 27), S(16, 32), S(17, 40), S(64, 71), S(170, 174), S(278, 262)
+ S(0, 0), S(2, 38), S(15, 36), S(22, 50), S(64, 81), S(166, 184), S(284, 269)
};
constexpr Score RookOnClosedFile = S(10, 5);
- constexpr Score RookOnOpenFile[] = { S(19, 6), S(47, 26) };
+ constexpr Score RookOnOpenFile[] = { S(18, 8), S(49, 26) };
// ThreatByMinor/ByRook[attacked PieceType] contains bonuses according to
// which piece type attacks which one. Attacks on lesser pieces which are
// pawn-defended are not considered.
constexpr Score ThreatByMinor[PIECE_TYPE_NB] = {
- S(0, 0), S(5, 32), S(55, 41), S(77, 56), S(89, 119), S(79, 162)
+ S(0, 0), S(6, 37), S(64, 50), S(82, 57), S(103, 130), S(81, 163)
};
constexpr Score ThreatByRook[PIECE_TYPE_NB] = {
- S(0, 0), S(3, 44), S(37, 68), S(42, 60), S(0, 39), S(58, 43)
+ S(0, 0), S(3, 44), S(36, 71), S(44, 59), S(0, 39), S(60, 39)
};
constexpr Value CorneredBishop = Value(50);
// Assorted bonuses and penalties
- constexpr Score UncontestedOutpost = S( 1, 10);
+ constexpr Score UncontestedOutpost = S( 0, 10);
constexpr Score BishopOnKingRing = S( 24, 0);
constexpr Score BishopXRayPawns = S( 4, 5);
constexpr Score FlankAttacks = S( 8, 0);
- constexpr Score Hanging = S( 69, 36);
+ constexpr Score Hanging = S( 72, 40);
constexpr Score KnightOnQueen = S( 16, 11);
constexpr Score LongDiagonalBishop = S( 45, 0);
constexpr Score MinorBehindPawn = S( 18, 3);
- constexpr Score PassedFile = S( 11, 8);
- constexpr Score PawnlessFlank = S( 17, 95);
- constexpr Score ReachableOutpost = S( 31, 22);
- constexpr Score RestrictedPiece = S( 7, 7);
+ constexpr Score PassedFile = S( 13, 8);
+ constexpr Score PawnlessFlank = S( 19, 97);
+ constexpr Score ReachableOutpost = S( 33, 19);
+ constexpr Score RestrictedPiece = S( 6, 7);
constexpr Score RookOnKingRing = S( 16, 0);
- constexpr Score SliderOnQueen = S( 60, 18);
- constexpr Score ThreatByKing = S( 24, 89);
+ constexpr Score SliderOnQueen = S( 62, 21);
+ constexpr Score ThreatByKing = S( 24, 87);
constexpr Score ThreatByPawnPush = S( 48, 39);
- constexpr Score ThreatBySafePawn = S(173, 94);
+ constexpr Score ThreatBySafePawn = S(167, 99);
constexpr Score TrappedRook = S( 55, 13);
constexpr Score WeakQueenProtection = S( 14, 0);
- constexpr Score WeakQueen = S( 56, 15);
+ constexpr Score WeakQueen = S( 57, 19);
#undef S
&& pos.piece_on(SQ_G7) == B_PAWN)
correction += CorneredBishop;
- return pos.side_to_move() == WHITE ? Value(5 * correction)
- : -Value(5 * correction);
+ return pos.side_to_move() == WHITE ? Value(3 * correction)
+ : -Value(3 * correction);
}
} // namespace Eval
// Deciding between classical and NNUE eval (~10 Elo): for high PSQ imbalance we use classical,
// but we switch to NNUE during long shuffling or with high material on the board.
if ( !useNNUE
- || abs(eg_value(pos.psq_score())) * 5 > (849 + pos.non_pawn_material() / 64) * (5 + pos.rule50_count()))
+ || abs(eg_value(pos.psq_score())) * 5 > (856 + pos.non_pawn_material() / 64) * (5 + pos.rule50_count()))
{
v = Evaluation<NO_TRACE>(pos).value(); // classical
- useClassical = abs(v) >= 298;
+ useClassical = abs(v) >= 297;
}
// If result of a classical evaluation is much lower than threshold fall back to NNUE
if (useNNUE && !useClassical)
{
Value nnue = NNUE::evaluate(pos, true); // NNUE
- int scale = 1136 + 20 * pos.non_pawn_material() / 1024;
+ int scale = 1036 + 20 * pos.non_pawn_material() / 1024;
Color stm = pos.side_to_move();
Value optimism = pos.this_thread()->optimism[stm];
Value psq = (stm == WHITE ? 1 : -1) * eg_value(pos.psq_score());
int complexity = 35 * abs(nnue - psq) / 256;
- optimism = optimism * (44 + complexity) / 32;
+ optimism = optimism * (44 + complexity) / 31;
v = (nnue + optimism) * scale / 1024 - optimism;
if (pos.is_chess960())
}
// Damp down the evaluation linearly when shuffling
- v = v * (208 - pos.rule50_count()) / 208;
+ v = v * (207 - pos.rule50_count()) / 207;
// Guarantee evaluation does not hit the tablebase range
v = std::clamp(v, VALUE_TB_LOSS_IN_MAX_PLY + 1, VALUE_TB_WIN_IN_MAX_PLY - 1);