Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keepstealing #501

Merged
merged 5 commits into from
Dec 24, 2024
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
7 changes: 7 additions & 0 deletions src/history.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ void updateHHScore(const Position* pos, SearchData* sd, const Move move, int bon
sd->searchHistory[pos->side][FromTo(move)] += scaledBonus;
}

void updateOppHHScore(const Position* pos, SearchData* sd, const Move move, int bonus) {
// Scale bonus to fix it in a [-HH_MAX;HH_MAX] range
const int scaledBonus = bonus - sd->searchHistory[pos->side ^ 1][FromTo(move)] * std::abs(bonus) / HH_MAX;
// Update move score
sd->searchHistory[pos->side ^ 1][FromTo(move)] += scaledBonus;
}

void updateRHScore(const Position *pos, SearchData *sd, const Move move, int bonus) {
// Scale bonus to fix it in a [-RH_MAX;RH_MAX] range
const int scaledBonus = bonus - GetRHScore(pos, sd, move) * std::abs(bonus) / RH_MAX;
Expand Down
1 change: 1 addition & 0 deletions src/history.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ int history_bonus(const int depth);
void CleanHistories(SearchData* sd);
// Updates history heuristics for a single move
void updateHHScore(const Position* pos, SearchData* sd, const Move move, int bonus);
void updateOppHHScore(const Position* pos, SearchData* sd, const Move move, int bonus);
void updateCHScore(SearchStack* ss, const Move move, const int bonus);
void updateCapthistScore(const Position* pos, SearchData* sd, const Move move, int bonus);
void updateSingleCHScore(SearchStack* ss, const Move move, const int bonus, const int offset);
Expand Down
8 changes: 8 additions & 0 deletions src/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,14 @@ int Negamax(int alpha, int beta, int depth, const bool cutNode, ThreadData* td,
StoreTTEntry(pos->posKey, NOMOVE, SCORE_NONE, rawEval, HFNONE, 0, pvNode, ttPv);
}

// Use static evaluation difference to improve quiet move ordering (~6 Elo)
if ((ss - 1)->staticEval != SCORE_NONE && isQuiet((ss - 1)->move))
{
int bonus = std::clamp(-10 * int((ss - 1)->staticEval + ss->staticEval), -1830, 1427) + 624;
Move move = (ss - 1)->move;
updateOppHHScore(pos, sd, move, bonus);
}

const int complexity = [&] {
if (eval == 0 || rawEval == 0)
return 0;
Expand Down
2 changes: 1 addition & 1 deletion src/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// include the tune stuff here to give it global visibility
#include "tune.h"

#define NAME "Alexandria-7.1.6"
#define NAME "Alexandria-7.1.7"

inline int reductions[2][64][64];
inline int lmp_margin[64][2];
Expand Down