tt aging | bench 1743358

This commit is contained in:
rektdie committed 2026-02-26 02:21:48 +01:00
1 parent 855e5c2377
commit 5ca125e336
3 files changed
+40 -4

No files matched your search

+27 -4
View File
@@ -10,18 +10,41 @@ void TTable::WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move b
current = &bucket->depthPreferred;
} else if (bucket->alwaysReplace && bucket->alwaysReplace.hashKey == hashKey) {
current = &bucket->alwaysReplace;
} else if (!bucket->alwaysReplace) {
current = &bucket->alwaysReplace;
} else if (!bucket->depthPreferred) {
current = &bucket->depthPreferred;
} else if (ttpv) {
current = &bucket->depthPreferred;
} else if (!bucket->depthPreferred || bucket->depthPreferred.depth <= depth) {
current = &bucket->depthPreferred;
} else {
current = &bucket->alwaysReplace;
const int depthPreferredValue = GetReplacementValue(bucket->depthPreferred);
const int alwaysReplaceValue = GetReplacementValue(bucket->alwaysReplace);
if (depthPreferredValue <= alwaysReplaceValue) {
current = &bucket->depthPreferred;
} else {
current = &bucket->alwaysReplace;
}
}
const bool samePosition = current->hashKey == hashKey;
const bool exactBound = nodeType == PV;
const bool entryFromCurrentAge = current->age == age;
const int writeDepth = depth + 4 + ttpv * 2;
if (samePosition && !exactBound && entryFromCurrentAge && writeDepth <= current->depth) {
return;
}
current->hashKey = hashKey;
current->nodeType = nodeType;
current->score = score;
current->depth = depth;
current->bestMove = bestMove;
if (bestMove || !samePosition) {
current->bestMove = bestMove;
}
current->age = age;
current->ttpv = ttpv;
}