From 9a2589c55368dcc14401c51dfb7c15445cf8c270 Mon Sep 17 00:00:00 2001 From: Matuush Date: Thu, 7 Nov 2024 22:26:08 +0100 Subject: [PATCH] Debug info if bot plays --- main.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/main.cpp b/main.cpp index 5b965fe..5fa1a0d 100644 --- a/main.cpp +++ b/main.cpp @@ -19,10 +19,8 @@ int main(int argc, char* argv[]) { int N = stoi(get_input("-n", args, "Length of sequence", "5")); int M = stoi(get_input("-m", args, "Number of colors", "8")); 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");; - string gen = RANDOM; - if(player != HUMAN) - gen = get_input("-g", args, "Who generates the seque", RANDOM); + bool learn = "y" == get_input("-l", args, "Do you want to know what bot learns [y/n]", "y"); + string gen = player == HUMAN ? RANDOM : get_input("-g", args, "Who generates the seque", RANDOM); // Generate the sequence auto sequence = vector(N); @@ -71,12 +69,12 @@ int main(int argc, char* argv[]) { response = validate(sequence, guess); cout << format_response(response); - if(learn) { + if(learn) bot.learn(guess, response); - bot.print(); - } } + if(learn) + bot.print(); history.push_back(guess); if(history.back() == sequence) break; }