removed ReadEntry function | bench 10412097
This commit is contained in:
1 parent
feb11b0b08
commit
311fc28c1c
2 files changed
+17
-29
No files matched your search
+17
-10
@@ -359,16 +359,22 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
if (ply && (IsDraw(board, ctx))) return 0;
|
||||
|
||||
|
||||
TTEntry entry = TTEntry(invalidEntry);
|
||||
TTEntry* entry = nullptr;
|
||||
if (!ctx->excluded)
|
||||
entry = ctx->TT.ReadEntry(board.hashKey, depth, alpha, beta);
|
||||
entry = ctx->TT.GetRawEntry(board.hashKey);
|
||||
|
||||
const bool ttHit = entry.score != invalidEntry;
|
||||
const bool ttHit = entry != nullptr && entry->score != invalidEntry;
|
||||
|
||||
// if NOT PV node then we try to hit the TTable
|
||||
if constexpr (!isPV) {
|
||||
if (ttHit)
|
||||
return SearchResults(entry.score, entry.bestMove);
|
||||
if (ttHit) {
|
||||
if ((entry->hashKey == board.hashKey && entry->depth >= depth) &&
|
||||
((entry->nodeType == PV) ||
|
||||
(entry->nodeType == AllNode && entry->score <= alpha) ||
|
||||
(entry->nodeType == CutNode && entry->score >= beta))) {
|
||||
|
||||
return SearchResults(entry->score, entry->bestMove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (depth <= 0) return Quiescence<mode>(board, alpha, beta, ply, ctx);
|
||||
@@ -480,12 +486,13 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
|
||||
if (ply
|
||||
&& depth >= 8
|
||||
&& currMove == entry.bestMove
|
||||
&& ttHit
|
||||
&& currMove == entry->bestMove
|
||||
&& ctx->excluded == 0
|
||||
&& entry.depth >= depth - 3
|
||||
&& entry.nodeType != AllNode)
|
||||
&& entry->depth >= depth - 3
|
||||
&& entry->nodeType != AllNode)
|
||||
{
|
||||
const int sBeta = std::max(-inf + 1, entry.score - depth * 2);
|
||||
const int sBeta = std::max(-inf + 1, entry->score - depth * 2);
|
||||
const int sDepth = (depth - 1) / 2;
|
||||
|
||||
ctx->excluded = currMove;
|
||||
|
||||
@@ -1,24 +1,5 @@
|
||||
#include "tt.h"
|
||||
|
||||
TTEntry TTable::ReadEntry(U64 &hashKey, int depth, int alpha, int beta) {
|
||||
TTEntry *current = &table[hashKey % table.size()];
|
||||
|
||||
if (current->hashKey == hashKey) {
|
||||
if (current->depth >= depth) {
|
||||
if (current->nodeType == PV){
|
||||
return *current;
|
||||
} else if (current->nodeType == AllNode && current->score <= alpha) {
|
||||
return *current;
|
||||
} else if (current->nodeType == CutNode && current->score >= beta) {
|
||||
return *current;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// returning invalid value
|
||||
return invalidEntry;
|
||||
}
|
||||
|
||||
void TTable::WriteEntry(U64 &hashKey, int depth, int score, int nodeType, Move bestMove) {
|
||||
TTEntry *current = &table[hashKey % table.size()];
|
||||
|
||||
|
||||
Reference in new issue
Block a user