Fixed timeout #7
+4
-7
@@ -84,8 +84,6 @@ void ListScores(Board &board) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static SearchResults Quiescence(Board board, int alpha, int beta) {
|
static SearchResults Quiescence(Board board, int alpha, int beta) {
|
||||||
if (searchStopped) return beta - alpha;
|
|
||||||
|
|
||||||
if (!benchStarted) {
|
if (!benchStarted) {
|
||||||
auto currTime = std::chrono::high_resolution_clock::now();
|
auto currTime = std::chrono::high_resolution_clock::now();
|
||||||
int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(currTime - timeStart).count();
|
int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(currTime - timeStart).count();
|
||||||
@@ -131,12 +129,11 @@ static SearchResults Quiescence(Board board, int alpha, int beta) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
results.score = alpha;
|
results.score = alpha;
|
||||||
|
if (searchStopped) return 0;
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchResults PVS(Board board, int depth, int alpha, int beta) {
|
SearchResults PVS(Board board, int depth, int alpha, int beta) {
|
||||||
if (searchStopped) return beta - alpha;
|
|
||||||
|
|
||||||
if (!benchStarted) {
|
if (!benchStarted) {
|
||||||
auto currTime = std::chrono::high_resolution_clock::now();
|
auto currTime = std::chrono::high_resolution_clock::now();
|
||||||
int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(currTime - timeStart).count();
|
int elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(currTime - timeStart).count();
|
||||||
@@ -221,6 +218,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta) {
|
|||||||
|
|
||||||
results.score = alpha;
|
results.score = alpha;
|
||||||
WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove);
|
WriteEntry(board.hashKey, depth, results.score, nodeType, results.bestMove);
|
||||||
|
if (searchStopped) return 0;
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -235,11 +233,10 @@ static SearchResults ID(Board &board, SearchParams params) {
|
|||||||
safeResults.score = -inf;
|
safeResults.score = -inf;
|
||||||
|
|
||||||
for (int depth = 1; depth <= 99; depth++) {
|
for (int depth = 1; depth <= 99; depth++) {
|
||||||
int timeRemaining = (fullTime / 20) + (inc / 2);
|
timeToSearch = (fullTime / 20) + (inc / 2);
|
||||||
timeToSearch = timeRemaining;
|
|
||||||
|
|
||||||
SearchResults currentResults = PVS(board, depth, -inf, inf);
|
SearchResults currentResults = PVS(board, depth, -inf, inf);
|
||||||
if (currentResults.score >= safeResults.score) {
|
if (currentResults.bestMove) {
|
||||||
safeResults = currentResults;
|
safeResults = currentResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user