Debug info if bot plays

This commit is contained in:
Matúš Púll 2024-11-07 22:26:08 +01:00
parent 2ccb889d5f
commit 9a2589c553

View file

@ -19,10 +19,8 @@ int main(int argc, char* argv[]) {
int N = stoi(get_input("-n", args, "Length of sequence", "5")); int N = stoi(get_input("-n", args, "Length of sequence", "5"));
int M = stoi(get_input("-m", args, "Number of colors", "8")); int M = stoi(get_input("-m", args, "Number of colors", "8"));
string player = get_input("-p", args, string("Who plays [")+HUMAN+"/"+BOT+"]", "bot"); string player = get_input("-p", args, string("Who plays [")+HUMAN+"/"+BOT+"]", "bot");
bool learn = "y" == get_input("-l", args, "Do you want to know what bot learns [y/n]", "y");; bool learn = "y" == get_input("-l", args, "Do you want to know what bot learns [y/n]", "y");
string gen = RANDOM; string gen = player == HUMAN ? RANDOM : get_input("-g", args, "Who generates the seque", RANDOM);
if(player != HUMAN)
gen = get_input("-g", args, "Who generates the seque", RANDOM);
// Generate the sequence // Generate the sequence
auto sequence = vector<int>(N); auto sequence = vector<int>(N);
@ -71,12 +69,12 @@ int main(int argc, char* argv[]) {
response = validate(sequence, guess); response = validate(sequence, guess);
cout << format_response(response); cout << format_response(response);
if(learn) { if(learn)
bot.learn(guess, response); bot.learn(guess, response);
bot.print();
}
} }
if(learn)
bot.print();
history.push_back(guess); history.push_back(guess);
if(history.back() == sequence) break; if(history.back() == sequence) break;
} }