Skip to content

Commit

Permalink
🦈 IMP: Move Iteration respecting History Bonus
Browse files Browse the repository at this point in the history
--- STC ---
ELO   | 6.56 +- 4.85 (95%)
SPRT  | 10.0+0.10s Threads=1 Hash=16MB
LLR   | 2.95 (-2.94, 2.94) [0.00, 5.00]
GAMES | N: 10640 W: 2981 L: 2780 D: 4879

--- LTC ---
ELO   | 3.36 +- 2.68 (95%)
SPRT  | 60.0+0.60s Threads=1 Hash=256MB
LLR   | 2.96 (-2.94, 2.94) [0.00, 5.00]
GAMES | N: 32992 W: 8602 L: 8283 D: 16107

Bench: 8004890
  • Loading branch information
TheBlackPlague authored Jun 6, 2023
1 parent e25f8db commit 4786274
Showing 1 changed file with 11 additions and 8 deletions.
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

0 comments on commit 4786274

Please sign in to comment.