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

🦈 IMP: Move Iteration respecting History Bonus #11

Merged
merged 4 commits into from
Jun 6, 2023
Merged
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
19 changes: 11 additions & 8 deletions src/Engine/Search.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,14 +304,15 @@ namespace StockDory
//endregion

//region Fail-soft Alpha Beta Negamax
int32_t bestEvaluation = -Infinity;
Move bestMove = NoMove;
EngineEntryType ttEntryType = AlphaUnchanged;
int32_t bestEvaluation = -Infinity;
Move bestMove = NoMove;
EngineEntryType ttEntryType = AlphaUnchanged;

const uint8_t lmpQuietThreshold = LMPQuietThresholdBase + depth * depth;
const bool lmp = !Root && !checked && depth <= LMPDepthThreshold;
const bool lmr = depth >= LMRDepthThreshold && !checked;
const int32_t historyBonus = depth * depth;
const bool lmp = !Root && !checked && depth <= LMPDepthThreshold;
const bool lmr = depth >= LMRDepthThreshold && !checked;
const int32_t historyBonus = depth * depth;
const uint8_t historyFactor = std::max(depth / 3, 1);

uint8_t quietMoveCount = 0;
for (uint8_t i = 0; i < moves.Count(); i++) {
Expand Down Expand Up @@ -385,11 +386,13 @@ namespace StockDory
KTable.Set<1>(ply, move);
}

HTable.Get(Board[move.From()].Piece(), Color, move.To()) += historyBonus;
HTable.Get(Board[move.From()].Piece(), Color, move.To())
+= historyBonus + i * historyFactor;

for (uint8_t q = 1; q < quietMoveCount; q++) {
const Move other = moves.UnsortedAccess(i - q);
HTable.Get(Board[other.From()].Piece(), Color, other.To()) -= historyBonus;
HTable.Get(Board[other.From()].Piece(), Color, other.To())
-= historyBonus + (quietMoveCount - q) * historyFactor;
}
}

Expand Down