encapsulated timeToSearch
This commit is contained in:
1 parent
ff811784fb
commit
7543a0d231
2 files changed
+5
-6
No files matched your search
+4
-6
@@ -9,8 +9,6 @@
|
|||||||
|
|
||||||
namespace SEARCH {
|
namespace SEARCH {
|
||||||
|
|
||||||
static inline int timeToSearch = 0;
|
|
||||||
|
|
||||||
void InitLMRTable() {
|
void InitLMRTable() {
|
||||||
for (int depth = 0; depth <= MAX_DEPTH; depth++) {
|
for (int depth = 0; depth <= MAX_DEPTH; depth++) {
|
||||||
for (int move = 0; move < MAX_MOVES; move++) {
|
for (int move = 0; move < MAX_MOVES; move++) {
|
||||||
@@ -135,7 +133,7 @@ static SearchResults Quiescence(Board board, int alpha, int beta, int ply, Searc
|
|||||||
if constexpr (mode != nodesMode) {
|
if constexpr (mode != nodesMode) {
|
||||||
if constexpr (mode != bench) {
|
if constexpr (mode != bench) {
|
||||||
if (ctx.nodes % 1024 == 0) {
|
if (ctx.nodes % 1024 == 0) {
|
||||||
if (ctx.sw.GetElapsedMS() >= timeToSearch) {
|
if (ctx.sw.GetElapsedMS() >= ctx.timeToSearch) {
|
||||||
StopSearch();
|
StopSearch();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -200,7 +198,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply, SearchCo
|
|||||||
if constexpr (mode != bench || mode != nodesMode) {
|
if constexpr (mode != bench || mode != nodesMode) {
|
||||||
if (ctx.nodes % 1024 == 0) {
|
if (ctx.nodes % 1024 == 0) {
|
||||||
if constexpr (mode == normal) {
|
if constexpr (mode == normal) {
|
||||||
if (ctx.sw.GetElapsedMS() >= timeToSearch) {
|
if (ctx.sw.GetElapsedMS() >= ctx.timeToSearch) {
|
||||||
StopSearch();
|
StopSearch();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -396,8 +394,8 @@ static SearchResults ID(Board &board, SearchParams params, SearchContext& ctx) {
|
|||||||
ctx.sw.Restart();
|
ctx.sw.Restart();
|
||||||
|
|
||||||
for (int depth = 1; depth <= toDepth; depth++) {
|
for (int depth = 1; depth <= toDepth; depth++) {
|
||||||
timeToSearch = std::max((fullTime / 20) + (inc / 2), 4);
|
ctx.timeToSearch = std::max((fullTime / 20) + (inc / 2), 4);
|
||||||
int softTime = timeToSearch * 0.65;
|
int softTime = ctx.timeToSearch * 0.65;
|
||||||
|
|
||||||
SearchResults currentResults = PVS<true, mode>(board, depth, alpha, beta, ply, ctx);
|
SearchResults currentResults = PVS<true, mode>(board, depth, alpha, beta, ply, ctx);
|
||||||
elapsed = ctx.sw.GetElapsedMS();
|
elapsed = ctx.sw.GetElapsedMS();
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ class SearchContext {
|
|||||||
public:
|
public:
|
||||||
U64 nodes = 0;
|
U64 nodes = 0;
|
||||||
U64 nodesToGo = 0;
|
U64 nodesToGo = 0;
|
||||||
|
int timeToSearch = 0;
|
||||||
|
|
||||||
bool doingNullMove = false;
|
bool doingNullMove = false;
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user