commit 94cd4734a6d4c1ef9e4d683855372019325e8549
parent f8a5dd96409dbbd8818aef7f6984dda121053c0a
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Fri, 1 Dec 2023 22:42:59 +0000
Change time limit formula
Diffstat:
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -3,7 +3,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(
Stellar
- VERSION 9.0.3
+ VERSION 9.0.4
DESCRIPTION "Chess engine written in C++"
HOMEPAGE_URL https://git.dimitrijedobrota.com/stellar.git
LANGUAGES CXX
diff --git a/src/engine/engine.cpp b/src/engine/engine.cpp
@@ -419,6 +419,8 @@ Move search_position(const uci::Settings &settingsr) {
rtable = repetition::Table();
Move lastBest;
+
+ uint64_t time_last = timer::get_ms();
uint8_t max_depth = settings->depth ? settings->depth : MAX_PLY;
for (uint8_t depth = 1; depth <= max_depth; depth++) {
lastBest = pvtable.best();
@@ -455,6 +457,10 @@ Move search_position(const uci::Settings &settingsr) {
std::cout << " pv " << pvtable << std::endl;
if (depth >= mate_ply) break;
+
+ uint64_t time_crnt = timer::get_ms();
+ if (!settings->depth && 2 * time_crnt - time_last > settings->stoptime) break;
+ time_last = time_crnt;
}
settings->board = board;