diff --git a/main.cpp b/main.cpp index cb95a75..cba1084 100644 --- a/main.cpp +++ b/main.cpp @@ -59,6 +59,7 @@ int main(void) { vector> history = {}; for(int guesses = 0; guesses < 10; guesses++) { vector guess(N), response; + cout << "Guess " << history.size() << " : "; // Bot playing if(player == BOT) { @@ -80,7 +81,7 @@ int main(void) { } history.push_back(guess); - if(response[1] == N) break; + if(history.back() == sequence) break; } // Terminal clearing @@ -91,5 +92,8 @@ int main(void) { for(auto guess : history) cout << format_guess_history(sequence, guess) << std::endl; + if(history.back() != sequence) + cout << format_lost_sequence(sequence) << std::endl; + return 0; } diff --git a/validate.hpp b/validate.hpp index 6aa4281..ec594ee 100644 --- a/validate.hpp +++ b/validate.hpp @@ -42,6 +42,7 @@ vector validate(vector sequence, vector guess) { #define YELLOW "\033[33m" #define GREEN "\033[32m" +#define RED "\033[31m" #define BACK "\033[0m" string format_response(vector response) { @@ -92,3 +93,10 @@ string format_guess_history(vector sequence, vector guess) { r_string += s + " "; return r_string; } + +string format_lost_sequence(vector sequence) { + string r = ""; + for(int col : sequence) + r += RED + to_string(col) + BACK + " "; + return r; +}