No globals #50
No files matched your search
+4
-6
@@ -14,8 +14,6 @@ U64 nodesToGo = 0;
|
|||||||
|
|
||||||
static inline int timeToSearch = 0;
|
static inline int timeToSearch = 0;
|
||||||
|
|
||||||
inline PVLine pvLine;
|
|
||||||
|
|
||||||
Stopwatch sw;
|
Stopwatch sw;
|
||||||
|
|
||||||
void InitLMRTable() {
|
void InitLMRTable() {
|
||||||
@@ -225,7 +223,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pvLine.SetLength(ply);
|
ctx.pvLine.SetLength(ply);
|
||||||
if (ply && (IsThreefold(board) || IsFifty(board) || IsInsuffMat(board))) return 0;
|
if (ply && (IsThreefold(board) || IsFifty(board) || IsInsuffMat(board))) return 0;
|
||||||
|
|
||||||
|
|
||||||
@@ -359,7 +357,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
|
|||||||
nodeType = PV;
|
nodeType = PV;
|
||||||
alpha = score;
|
alpha = score;
|
||||||
results.bestMove = currMove;
|
results.bestMove = currMove;
|
||||||
pvLine.SetMove(ply, currMove);
|
ctx.pvLine.SetMove(ply, currMove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -442,7 +440,7 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext& ctx) {
|
|||||||
std::cout << " nodes " << ctx.nodes << " nps " << int(ctx.nodes/sw.GetElapsedSec());
|
std::cout << " nodes " << ctx.nodes << " nps " << int(ctx.nodes/sw.GetElapsedSec());
|
||||||
std::cout << " hashfull " << TT.GetUsedPercentage();
|
std::cout << " hashfull " << TT.GetUsedPercentage();
|
||||||
std::cout << " pv ";
|
std::cout << " pv ";
|
||||||
pvLine.Print(0);
|
ctx.pvLine.Print(0);
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
|
|
||||||
if constexpr (mode == normal) {
|
if constexpr (mode == normal) {
|
||||||
@@ -473,7 +471,7 @@ SearchResults SearchPosition(Board &board, SearchParams params, SearchContext& c
|
|||||||
nodesToGo = params.nodes;
|
nodesToGo = params.nodes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pvLine.Clear();
|
ctx.pvLine.Clear();
|
||||||
|
|
||||||
SearchResults results = ID<mode>(board, params, ctx);
|
SearchResults results = ID<mode>(board, params, ctx);
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -110,8 +110,11 @@ class SearchContext {
|
|||||||
public:
|
public:
|
||||||
U64 nodes = 0;
|
U64 nodes = 0;
|
||||||
bool doingNullMove = false;
|
bool doingNullMove = false;
|
||||||
|
PVLine pvLine;
|
||||||
|
|
||||||
SearchContext(){}
|
SearchContext(){
|
||||||
|
pvLine.Clear();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <bool isPV, searchMode mode>
|
template <bool isPV, searchMode mode>
|
||||||
|
|||||||
Reference in new issue
Block a user