aboutsummaryrefslogtreecommitdiff
path: root/src/uci.cpp
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-31 15:14:12 +0200
committerAdam <adammegarules1@gmail.com>2026-07-31 15:14:12 +0200
commit63f380a48ab21f39962b60837fa487e9f978be95 (patch)
treedea75673c058220603c1b34c2b5a0b598f973bad /src/uci.cpp
parentf47ac9172ce75ab5f359cfebb2c44d6784e956a4 (diff)
adding perft
Diffstat (limited to 'src/uci.cpp')
-rw-r--r--src/uci.cpp18
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();
}
}
}