diff --git a/format.hpp b/format.hpp index a339cd8..f0500a8 100644 --- a/format.hpp +++ b/format.hpp @@ -9,7 +9,9 @@ using std::to_string; #define YELLOW "\033[33m" #define GREEN "\033[32m" #define RED "\033[31m" -#define BACK "\033[0m" +#define BACK "\033[0;0;0m" +#define UNDERLINE "\033[0;0;4m" + string format_response(vector response) { return YELLOW + to_string(response[0]) + BACK + " / " + diff --git a/main.cpp b/main.cpp index 93fcca0..b17571e 100644 --- a/main.cpp +++ b/main.cpp @@ -10,6 +10,7 @@ using std::cout; using std::cin; using std::string; using std::vector; +using std::getline; // To avoid typos #define BOT "bot" @@ -18,19 +19,23 @@ using std::vector; int main(void) { // Take game parameters - cout << "Length of sequence : "; - int N; cin >> N; + cout << "Length of sequence (default=5) : "; + string string_N; getline(cin, string_N); + int N = (string_N == "") ? 5 : stoi(string_N); - cout << "Number of colors : "; - int M; cin >> M; + cout << "Number of colors (default=8) : "; + string string_M; getline(cin, string_M); + int M = (string_M == "") ? 8 : stoi(string_M); - cout << "Who plays [" << HUMAN << "/" << BOT << "] : "; - string player; cin >> player; + cout << "Who plays [" << UNDERLINE << HUMAN << BACK << "/" << BOT << "] : "; + string player; getline(cin, player); + if(player == "") player = HUMAN; bool learn = 0; if(player == HUMAN) { - cout << "Do you want to know what bot learns [y/n] : "; - string reply; cin >> reply; + cout << "Do you want to know what bot learns [" << UNDERLINE << "y" << BACK << "/n] : "; + string reply; getline(cin, reply); + if(reply == "") reply = "y"; learn = (reply == "y"); }