diff options
Diffstat (limited to 'src/uci.cpp')
| -rw-r--r-- | src/uci.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/uci.cpp b/src/uci.cpp index 89d28dd..8c24ed4 100644 --- a/src/uci.cpp +++ b/src/uci.cpp @@ -11,6 +11,7 @@ #include <cctype> #include <cstdint> #include <cstdio> +#include <cstdlib> #include <iostream> #include <sstream> #include <string> @@ -49,6 +50,7 @@ Move UciToMove(string uci) { return {from, to}; } + Game initBoard( string startingFEN, std::unordered_map<uint64_t, TranspositionsEntry> *transPositions) { @@ -115,7 +117,6 @@ void Uci() { cout << "readyok\n"; cout.flush(); } else if (cmd.starts_with("go")) { - stringstream ss(line); string token; @@ -195,6 +196,21 @@ void Uci() { MakeMove(move, &game); } + } else if (cmd.starts_with("perft")) { + std::istringstream iss(cmd); + + std::string word; + int depth = -1; + + if (!(iss >> word >> depth) || word != "perft" || depth < 0) { + cout << "info string usage: perft <non-negative depth>\n"; + cout.flush(); + continue; + } + int count = MoveGenTest(depth, &game); + + cout << count << "\n"; + cout.flush(); } } } |
