more tunables | bench 1398874

This commit is contained in:
rektdie committed 2026-04-02 00:29:11 +02:00
1 parent d4ed1a3f40
commit 34018414df
2 files changed
+31 -13

No files matched your search

+17 -11
View File
@@ -435,7 +435,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
ttAdjustedEval = entry.score;
}
bool corrplexity = std::abs(rawEval - staticEval) > 70;
bool corrplexity = std::abs(rawEval - staticEval) > corrplexityThreshold;
const bool improving = [&]
{
@@ -498,7 +498,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
}
// Probcut
const int probcutBeta = beta + 200;
const int probcutBeta = beta + probcutBetaMargin;
const int probcutDepth = std::max(depth - 3, 1);
if (depth >= 7 && std::abs(beta) < MATE_SCORE - MAX_DEPTH
@@ -728,12 +728,18 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
// Fail high (beta cutoff)
if (score >= beta) {
int bonus = historyBonusMultiplier * (depth + (!board.InCheck() && staticEval <= alpha)) - historyBonusSub;
const int bonusDepth = depth + (!board.InCheck() && staticEval <= alpha);
int historyBonus = historyBonusMultiplier * bonusDepth - historyBonusSub;
int historyMalus = historyMalusMultiplier * bonusDepth - historyMalusSub;
int contHistoryBonus = contHistoryBonusMultiplier * bonusDepth - contHistoryBonusSub;
int contHistoryMalus = contHistoryMalusMultiplier * bonusDepth - contHistoryMalusSub;
int captHistoryBonus = captHistoryBonusMultiplier * bonusDepth - captHistoryBonusSub;
int captHistoryMalus = captHistoryMalusMultiplier * bonusDepth - captHistoryMalusSub;
if (!currMove.IsCapture()) {
ctx->killerMoves[ply] = currMove;
ctx->history.Update(board.sideToMove, currMove, sourceThreatened, targetThreatened, bonus);
ctx->history.Update(board.sideToMove, currMove, sourceThreatened, targetThreatened, historyBonus);
if (ply > 0) {
int prevType = ctx->ss[ply-1].pieceType;
@@ -742,14 +748,14 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
int to = ctx->ss[ply].moveTo;
bool otherColor = ctx->ss[ply-1].side;
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, bonus);
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, contHistoryBonus);
// Malus
for (int moveIndex = 0; moveIndex < seenQuietsCount - 1; moveIndex++) {
int pieceType = board.GetPieceType(seenQuiets[moveIndex].MoveFrom());
int to = seenQuiets[moveIndex].MoveTo();
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, -bonus);
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, -contHistoryMalus);
}
if (ply > 1) {
@@ -757,14 +763,14 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
prevTo = ctx->ss[ply-2].moveTo;
otherColor = ctx->ss[ply-2].side;
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, bonus);
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, contHistoryBonus);
// Malus
for (int moveIndex = 0; moveIndex < seenQuietsCount - 1; moveIndex++) {
int pieceType = board.GetPieceType(seenQuiets[moveIndex].MoveFrom());
int to = seenQuiets[moveIndex].MoveTo();
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, -bonus);
ctx->conthist.Update(board.sideToMove, otherColor, prevType, prevTo, pieceType, to, -contHistoryMalus);
}
}
@@ -776,7 +782,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
sourceThreatened = board.IsSquareThreatened(board.sideToMove, seenQuiets[moveIndex].MoveFrom());
targetThreatened = board.IsSquareThreatened(board.sideToMove, seenQuiets[moveIndex].MoveTo());
ctx->history.Update(board.sideToMove, seenQuiets[moveIndex], sourceThreatened, targetThreatened, -bonus);
ctx->history.Update(board.sideToMove, seenQuiets[moveIndex], sourceThreatened, targetThreatened, -historyMalus);
}
} else {
int movingPiece = board.GetPieceType(currMove.MoveFrom());
@@ -786,7 +792,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
capturedPiece = Pawn;
}
ctx->capthist.Update(board.sideToMove, movingPiece, capturedPiece, currMove.MoveTo(), bonus);
ctx->capthist.Update(board.sideToMove, movingPiece, capturedPiece, currMove.MoveTo(), captHistoryBonus);
}
// Capthist malus
@@ -803,7 +809,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
}
ctx->capthist.Update(board.sideToMove, movingPiece, capturedPiece,
seenCaptures[moveIndex].MoveTo(), -bonus);
seenCaptures[moveIndex].MoveTo(), -captHistoryMalus);
}
if (!ctx->excluded)
+14 -2
View File
@@ -23,9 +23,11 @@
X_INT(lmrTTPVFailLow, 1024, 256, 2048) \
X_INT(lmrDeeperBase, 30, 0, 96) \
X_INT(lmrDeeperScalar, 4, 0, 16) \
X_INT(corrplexityThreshold, 70, 32, 128) \
X_INT(rfpBase, 25, 50, 200) \
X_INT(rfpMargin, 100, 50, 200) \
X_INT(fpMargin, 100, 50, 200) \
X_INT(probcutBetaMargin, 200, 100, 300) \
X_INT(razoringScalar, 200, 80, 320) \
X_INT(doubleExtMargin, 30, 8, 64) \
X_INT(seeQuietThreshold, -80, -160, 0) \
@@ -40,8 +42,18 @@
X_INT(seeQsThreshold, 0, -120, 120) \
X_INT(seeOrderingThreshold, -100, -200, 0) \
X_INT(ldseMargin, 25, 0, 96) \
X_INT(historyBonusMultiplier, 300, 200, 500) \
X_INT(historyBonusSub, 250, 128, 384)
X_INT(historyBonusMultiplier, 300, 270, 330) \
X_INT(historyBonusSub, 250, 230, 280) \
X_INT(historyMalusMultiplier, 300, 270, 330) \
X_INT(historyMalusSub, 250, 230, 280) \
X_INT(contHistoryBonusMultiplier, 300, 270, 330) \
X_INT(contHistoryBonusSub, 250, 230, 280) \
X_INT(contHistoryMalusMultiplier, 300, 270, 330) \
X_INT(contHistoryMalusSub, 250, 230, 280) \
X_INT(captHistoryBonusMultiplier, 300, 270, 330) \
X_INT(captHistoryBonusSub, 250, 230, 280) \
X_INT(captHistoryMalusMultiplier, 300, 270, 330) \
X_INT(captHistoryMalusSub, 250, 230, 280)
#ifdef TUNING
#define X_DOUBLE(name, default_val, min_val, max_val) \