diff options
| author | Adam <adammegarules1@gmail.com> | 2026-08-08 17:37:52 +0200 |
|---|---|---|
| committer | Adam <adammegarules1@gmail.com> | 2026-08-08 17:37:52 +0200 |
| commit | f4e219a591d0265e95f173c1da5c9563c9680adc (patch) | |
| tree | cbe46bfbf1165b9a809d3d6a3672b2933b6f1dcf /src/uci.cpp | |
| parent | 9cbe5a0fbd3ca3a10703452d2aaf3a5c3759c704 (diff) | |
adding time management
Diffstat (limited to 'src/uci.cpp')
| -rw-r--r-- | src/uci.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
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<char>(best.From.file + 'a') << 1 + best.From.rank |
