Fix time management for big times
Diffstat:
3 files changed, 4 insertions(+), 5 deletions(-)
@@ -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
@@ -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
@@ -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;