From f4e219a591d0265e95f173c1da5c9563c9680adc Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 8 Aug 2026 17:37:52 +0200 Subject: adding time management --- src/uci.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/uci.cpp') diff --git a/src/uci.cpp b/src/uci.cpp index 37a68b8..6d2f652 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -191,19 +191,37 @@ void Uci() { string token; int depth = -1; + int wtime = -1; + int btime = -1; + + int wncr = 0; + int bncr = 0; + ss >> token; // go while (ss >> token) { if (token == "depth") { ss >> depth; - break; + } + if (token == "wtime") { + ss >> wtime; + } + if (token == "btime") { + ss >> btime; + } + if (token == "incr") { + ss >> wncr; + bncr = wncr; } } + if (depth != -1 && depth <= 0) { cout << "Fatal: Depth must be positive integer"; exit(1); } - Move best = GetBestMove(&game, depth); + move_options options = { + .wtime = wtime, .btime = btime, .wncr = wncr, .bncr = bncr}; + Move best = GetBestMove(&game, depth, options); cout << "bestmove "; cout << static_cast(best.From.file + 'a') << 1 + best.From.rank -- cgit v1.2.3