Skip to content

Commit

Permalink
Merge branch 'official-stockfish:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
RainRat authored May 16, 2024
2 parents f3ca45a + 4759764 commit 4933d8c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions src/evaluate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
assert(!pos.checkers());

int simpleEval = simple_eval(pos, pos.side_to_move());
bool smallNet = std::abs(simpleEval) > SmallNetThreshold;
bool smallNet = std::abs(simpleEval) > SmallNetThreshold + 6 * pos.count<PAWN>();
int nnueComplexity;
int v;

Expand All @@ -68,10 +68,10 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
smallNet = false;
}

const auto adjustEval = [&](int nnueDiv, int pawnCountMul, int shufflingConstant) {
const auto adjustEval = [&](int pawnCountMul, int shufflingConstant) {
// Blend optimism and eval with nnue complexity and material imbalance
optimism += optimism * (nnueComplexity + std::abs(simpleEval - nnue)) / 584;
nnue -= nnue * (nnueComplexity * 5 / 3) / nnueDiv;
nnue -= nnue * (nnueComplexity * 5 / 3) / 32395;

int npm = pos.non_pawn_material() / 64;
v = (nnue * (npm + 943 + pawnCountMul * pos.count<PAWN>()) + optimism * (npm + 140)) / 1058;
Expand All @@ -82,9 +82,9 @@ Value Eval::evaluate(const Eval::NNUE::Networks& networks,
};

if (!smallNet)
adjustEval(32395, 11, 178);
adjustEval(11, 178);
else
adjustEval(32793, 9, 206);
adjustEval(9, 206);

// 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);
Expand Down
2 changes: 1 addition & 1 deletion src/evaluate.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Position;

namespace Eval {

constexpr inline int SmallNetThreshold = 1174;
constexpr inline int SmallNetThreshold = 1126;

// The default net name MUST follow the format nn-[SHA256 first 12 digits].nnue
// for the build process (profile-build and fishtest) to work. Do not change the
Expand Down
2 changes: 1 addition & 1 deletion src/nnue/nnue_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void hint_common_parent_position(const Position& pos,
AccumulatorCaches& caches) {

int simpleEvalAbs = std::abs(simple_eval(pos, pos.side_to_move()));
if (simpleEvalAbs > Eval::SmallNetThreshold)
if (simpleEvalAbs > Eval::SmallNetThreshold + 6 * pos.count<PAWN>())
networks.small.hint_common_access(pos, &caches.small);
else
networks.big.hint_common_access(pos, &caches.big);
Expand Down
3 changes: 0 additions & 3 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,9 +1134,6 @@ Value Search::Worker::search(
if (PvNode)
r--;

if (improving && ttValue <= alpha && move != ttMove)
r++;

// Increase reduction if next ply has a lot of fail high (~5 Elo)
if ((ss + 1)->cutoffCnt > 3)
r++;
Expand Down

0 comments on commit 4933d8c

Please sign in to comment.