commit d22cfaeb45ea65c1cfcdd598d524d10603b700b1
parent c16369677bc656d2d9b17038f4697b2610dc8156
Author: Dimitrije Dobrota <mail@dimitrijedobrota.com>
Date: Thu, 20 Jun 2024 20:12:11 +0200
Fix time management for big times
Diffstat:
3 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
@@ -3,7 +3,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(
Stellar
- VERSION 1.4.1
+ VERSION 1.4.2
DESCRIPTION "Chess engine written in C++"
HOMEPAGE_URL https://git.dimitrijedobrota.com/stellar.git
LANGUAGES CXX
diff --git a/README.md b/README.md
@@ -72,7 +72,6 @@ for up to date rating against other engines.
- 1.0
* Initial Release
-
## License
This project is licensed under the MIT License - see the LICENSE.md file for details
diff --git a/src/engine/uci.cpp b/src/engine/uci.cpp
@@ -83,7 +83,7 @@ void loop() {
} else if (command == "go") {
settings.searchMoves.clear();
uint64_t wtime = 0, btime = 0, movetime = 0;
- uint16_t winc = 0, binc = 0, movestogo = 40;
+ uint64_t winc = 0, binc = 0, movestogo = 40;
while (iss >> command) {
if (command == "wtime") iss >> wtime;
@@ -115,14 +115,14 @@ void loop() {
}
}
- uint16_t time_left = board.get_side() == WHITE ? wtime : btime;
+ auto time_left = board.get_side() == WHITE ? wtime : btime;
int64_t time = 0;
if (movetime != 0) {
time = movetime;
movestogo = 1;
} else if (time_left != 0) {
- uint16_t inc = board.get_side() == WHITE ? winc : binc;
+ auto inc = board.get_side() == WHITE ? winc : binc;
time = time_left / movestogo + inc / 2;
if (time > time_left) time = time_left - 500;
if (time <= 0) time = 100;