diff options
Diffstat (limited to 'src/uci.cpp')
| -rw-r--r-- | src/uci.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/uci.cpp b/src/uci.cpp index 8a7ad9a..e6aec4e 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -9,7 +9,6 @@ #include <cctype> #include <cstdint> #include <iostream> -#include <print> #include <sstream> #include <string> @@ -126,11 +125,27 @@ void Uci() { cout << "readyok\n"; cout.flush(); } else if (cmd.starts_with("go")) { - Move best = EngineGetBestMove(&game); + + stringstream ss(line); + + string token; + int depth = 4; // default depth + + ss >> token; // go + + while (ss >> token) { + if (token == "depth") { + ss >> depth; + break; + } + } + + Move best = EngineGetBestMove(&game, depth); cout << "bestmove "; cout << (char)(best.From.file + 'a') << 8 - best.From.rank << (char)(best.To.file + 'a') << 8 - best.To.rank; + if (best.promotion != NONEPIECE) { switch (best.promotion) { case QUEEN: @@ -146,10 +161,11 @@ void Uci() { cout << "b"; break; default: - assert(false && "Unexepted promotion type"); + assert(false && "Unexpected promotion type"); } } - println(); + + cout << "\n"; SaveTranspositionTable(transpositions); cout.flush(); } else if (cmd.starts_with("position")) { |
