stellar

UCI Chess engine written in C++20
git clone git://git.dimitrijedobrota.com/stellar.git
Log | Files | Refs | README | LICENSE |

commitac15a56b21d7e7a0b3994dd62b8c47605400c947
parent3b35974c0662fb2d1d5bc7bead88a5f53e0bee28
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateTue, 12 Sep 2023 13:42:22 +0200

Fix UCI time management

Diffstat:
MCMakeLists.txt|+-
Msrc/engine/uci.cpp|++--
Msrc/engine/uci.hpp|++--
Msrc/piece/piece.hpp|+-

4 files changed, 6 insertions(+), 6 deletions(-)


diff --git a/CMakeLists.txt b/CMakeLists.txt

@@ -3,7 +3,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

project(
Stellar
VERSION 0.0.34
VERSION 0.0.35
DESCRIPTION "Chess engine written in C"
HOMEPAGE_URL https://git.dimitrijedobrota.com/stellar.git
LANGUAGES C CXX

diff --git a/src/engine/uci.cpp b/src/engine/uci.cpp

@@ -99,7 +99,7 @@ void loop(void) {

}
} else if (command == "go") {
settings.searchMoves.clear();
uint32_t wtime = 0, btime = 0, movetime = 0;
uint64_t wtime = 0, btime = 0, movetime = 0;
uint16_t winc = 0, binc = 0, movestogo = 60;
while (iss >> command) {

@@ -145,7 +145,7 @@ void loop(void) {

uint16_t inc = (settings.board.get_side() == color::WHITE) ? winc : binc;
time /= movestogo;
time -= 50;
settings.stoptime = settings.starttime += time + inc;
settings.stoptime = settings.starttime + time + inc;
settings.infinite = false;
}

diff --git a/src/engine/uci.hpp b/src/engine/uci.hpp

@@ -21,8 +21,8 @@ struct Settings {

MoveList searchMoves;
MoveList madeMoves;
uint32_t starttime;
uint32_t stoptime;
uint64_t starttime;
uint64_t stoptime;
uint16_t depth = 64;
uint32_t nodes = 0;

diff --git a/src/piece/piece.hpp b/src/piece/piece.hpp

@@ -57,7 +57,7 @@ inline constexpr const U64 get_attack(const Type type, const color::Color color,

return get(type, color).attack(from, occupancy);
}
inline constexpr const char get_code(const Type type, const color::Color color = color::WHITE) {
inline constexpr const char get_code(const Type type, const color::Color color = color::BLACK) {
return get(type, color).code;
}