From 4aac933e3c08535501558448ce43ce610b5e317f Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 29 Jul 2026 19:55:22 +0200 Subject: adding depth support --- src/uci.cpp | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'src/uci.cpp') 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 #include #include -#include #include #include @@ -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")) { -- cgit v1.2.3