Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ Value Worker::search(
if (!is_in_check) {
correction = m_td.history.get_correction(pos);
raw_eval = tt_data && !is_mate_score(tt_data->eval) ? tt_data->eval : evaluate(pos);
ss->static_eval = raw_eval + correction;
ss->static_eval = adj_shuffle(pos, raw_eval) + correction;
improving = (ss - 2)->static_eval != -VALUE_INF && ss->static_eval > (ss - 2)->static_eval;

if (!tt_data) {
Expand Down Expand Up @@ -952,7 +952,7 @@ Value Worker::quiesce(const Position& pos, Stack* ss, Value alpha, Value beta, i
if (!is_in_check) {
correction = m_td.history.get_correction(pos);
raw_eval = tt_data && !is_mate_score(tt_data->eval) ? tt_data->eval : evaluate(pos);
static_eval = raw_eval + correction;
static_eval = adj_shuffle(pos, raw_eval) + correction;

if (!tt_data) {
m_searcher.tt.store(pos, ply, raw_eval, Move::none(), -VALUE_INF, 0, ttpv, Bound::None);
Expand Down Expand Up @@ -1045,5 +1045,19 @@ Value Worker::evaluate(const Position& pos) {
return -VALUE_INF; // Not implemented in tune mode
#endif
}

Value Worker::adj_shuffle(const Position& pos, Value value) {
// During datagen, use raw evals only.
// source: chef.
if (m_searcher.settings.datagen) {
return value;
}

// Scale down the value when the fifty-move counter is high.
i32 clock = pos.get_50mr_counter();
value = value * (200 - clock) / 200;

return value;
}
} // namespace Search
} // namespace Clockwork
1 change: 1 addition & 0 deletions src/search.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ class alignas(128) Worker {
template<bool IS_MAIN>
Value quiesce(const Position& pos, Stack* ss, Value alpha, Value beta, i32 ply);
Value evaluate(const Position& pos);
Value adj_shuffle(const Position& pos, Value value);
bool check_tm_hard_limit();
};

Expand Down
Loading