encapsulated TT | bench 1857933
This commit is contained in:
1 parent
c08c545335
commit
53f6ae17bc
7 files changed
+43
-49
No files matched your search
+6
-7
@@ -3,7 +3,6 @@
|
||||
#include "evaluate.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include "tt.h"
|
||||
#include "datagen.h"
|
||||
#include "benchmark.h"
|
||||
|
||||
@@ -25,7 +24,7 @@ void InitLMRTable() {
|
||||
}
|
||||
|
||||
static int ScoreMove(Board &board, Move &move, int ply, SearchContext& ctx) {
|
||||
TTEntry *current = TT.GetRawEntry(board.hashKey);
|
||||
TTEntry *current = ctx.TT.GetRawEntry(board.hashKey);
|
||||
if (current->bestMove == move) {
|
||||
return 50000;
|
||||
}
|
||||
@@ -148,7 +147,7 @@ static SearchResults Quiescence(Board& board, int alpha, int beta, int ply, Sear
|
||||
|
||||
int bestScore = HCE::Evaluate(board);
|
||||
|
||||
TTEntry *entry = TT.GetRawEntry(board.hashKey);
|
||||
TTEntry *entry = ctx.TT.GetRawEntry(board.hashKey);
|
||||
if (entry->hashKey == board.hashKey) {
|
||||
bestScore = entry->score;
|
||||
}
|
||||
@@ -222,7 +221,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
|
||||
// if NOT PV node then we try to hit the TTable
|
||||
if constexpr (!isPV) {
|
||||
SearchResults entry = TT.ReadEntry(board.hashKey, depth, alpha, beta);
|
||||
SearchResults entry = ctx.TT.ReadEntry(board.hashKey, depth, alpha, beta);
|
||||
if (entry.score != invalidEntry) {
|
||||
return entry;
|
||||
}
|
||||
@@ -340,7 +339,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
}
|
||||
}
|
||||
|
||||
TT.WriteEntry(board.hashKey, depth, score, CutNode, Move());
|
||||
ctx.TT.WriteEntry(board.hashKey, depth, score, CutNode, Move());
|
||||
return score;
|
||||
}
|
||||
|
||||
@@ -363,7 +362,7 @@ SearchResults PVS(Board& board, int depth, int alpha, int beta, int ply, SearchC
|
||||
}
|
||||
|
||||
if (ctx.searchStopped) return 0;
|
||||
TT.WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove);
|
||||
ctx.TT.WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove);
|
||||
return results;
|
||||
}
|
||||
|
||||
@@ -431,7 +430,7 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext& ctx) {
|
||||
std::cout << " time " << elapsed;
|
||||
std::cout << " score cp " << UTILS::ConvertToWhiteRelative(board, safeResults.score);
|
||||
std::cout << " nodes " << ctx.nodes << " nps " << int(ctx.nodes/ctx.sw.GetElapsedSec());
|
||||
std::cout << " hashfull " << TT.GetUsedPercentage();
|
||||
std::cout << " hashfull " << ctx.TT.GetUsedPercentage();
|
||||
std::cout << " pv ";
|
||||
ctx.pvLine.Print(0);
|
||||
std::cout << std::endl;
|
||||
|
||||
Reference in new issue
Block a user