added stop UCI command + little adjustments
This commit is contained in:
1 parent
aaa3a72081
commit
81c52f05e3
5 files changed
+39
-11
No files matched your search
+13
-2
@@ -2,6 +2,7 @@
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include "types.h"
|
||||
#include "movegen.h"
|
||||
#include "search.h"
|
||||
@@ -162,8 +163,9 @@ void ParseGo(Board &board, std::string &command) {
|
||||
params.winc = ReadParam("winc", command);
|
||||
params.binc = ReadParam("binc", command);
|
||||
params.movesToGo = ReadParam("movestogo", command);
|
||||
|
||||
SearchPosition(board, params);
|
||||
|
||||
auto worker = std::thread(SearchPosition, std::ref(board), std::ref(params));
|
||||
worker.detach();
|
||||
}
|
||||
|
||||
void UCILoop(Board &board) {
|
||||
@@ -222,11 +224,20 @@ void UCILoop(Board &board) {
|
||||
break;
|
||||
}
|
||||
|
||||
// parse UCI "stop" command
|
||||
if (input.find("stop") != std::string::npos) {
|
||||
// stop the loop
|
||||
StopSearch();
|
||||
continue;
|
||||
}
|
||||
|
||||
// parse UCI "uci" command
|
||||
if (input.find("uci") != std::string::npos) {
|
||||
// print engine info
|
||||
std::cout << "id name Eleanor\n";
|
||||
std::cout << "id name rektdie\n";
|
||||
std::cout << "option name Hash type spin default 1 min 1 max 1\n";
|
||||
std::cout << "option name Threads type spin default 1 min 1 max 1\n";
|
||||
std::cout << "uciok\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user