-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
29 lines (24 loc) · 849 Bytes
/
Copy pathmain.cpp
File metadata and controls
29 lines (24 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include "uci.h"
#include <iostream>
#include <string>
#include <sstream>
#include <chrono>
int main() {
// Enable unbuffered output for UCI protocol compatibility
std::cout.setf(std::ios::unitbuf);
std::cerr.setf(std::ios::unitbuf);
global_rng.seed(std::chrono::steady_clock::now().time_since_epoch().count());
std::string line;
while (std::getline(std::cin, line)) {
std::istringstream iss(line);
std::string command;
iss >> command;
if (command == "uci") { handleUci(); }
else if (command == "isready") { handleIsReady(); }
else if (command == "ucinewgame") { handleUciNewGame(); }
else if (command == "position") { handlePosition(iss); }
else if (command == "go") { handleGo(iss); }
else if (command == "quit") { break; }
}
return 0;
}