For some reason the second command I send to my C++ console it keeps returning the same value as the last.
I think the problem lies in this part of this code. If you need need more part of the code let me know.
C++:
std::string delimiter = ";;";
std::string line = "";
while (std::getline(std::cin, line)) {
size_t pos = 0;
while ((pos = line.find(delimiter)) != std::string::npos) {
ttoken = line.substr(0, pos);
// std::cout << ttoken << std::endl;
if (count == 0) {
index = ttoken;
} else if (count == 1) {
token = ttoken;
} else if (count == 2) {
scoreDt = ttoken;
} else if (count == 3) {
dataEn1 = ttoken;
} else if (count == 4) {
dataEn2 = ttoken;
} else if (count == 5) {
dataEn3 = ttoken;
} else {
dataEn4 = ttoken;
}
line.erase(0, pos + delimiter.length());
count++;
}
if (index == "ready") {
std::cout << "ok" << std::endl;
}
if (index == "search") {
// set position var here.
bestMove = search.findBestMove(position);
lastBestScore = search.getLastBestScore();
std::cout << bestMove.from << "|" << bestMove.to << "|" << bestMove.bit << "|" << lastBestScore << std::endl;
}
if (index == "quit") {
break;
}
}
I think the problem lies in this part of this code. If you need need more part of the code let me know.