Added defaults

This commit is contained in:
Matúš Púll 2024-11-07 12:02:50 +01:00
parent d68126bfbb
commit 2304c0277a
2 changed files with 16 additions and 9 deletions

View file

@ -9,7 +9,9 @@ using std::to_string;
#define YELLOW "\033[33m" #define YELLOW "\033[33m"
#define GREEN "\033[32m" #define GREEN "\033[32m"
#define RED "\033[31m" #define RED "\033[31m"
#define BACK "\033[0m" #define BACK "\033[0;0;0m"
#define UNDERLINE "\033[0;0;4m"
string format_response(vector<int> response) { string format_response(vector<int> response) {
return YELLOW + to_string(response[0]) + BACK + " / " + return YELLOW + to_string(response[0]) + BACK + " / " +

View file

@ -10,6 +10,7 @@ using std::cout;
using std::cin; using std::cin;
using std::string; using std::string;
using std::vector; using std::vector;
using std::getline;
// To avoid typos // To avoid typos
#define BOT "bot" #define BOT "bot"
@ -18,19 +19,23 @@ using std::vector;
int main(void) { int main(void) {
// Take game parameters // Take game parameters
cout << "Length of sequence : "; cout << "Length of sequence (default=5) : ";
int N; cin >> N; string string_N; getline(cin, string_N);
int N = (string_N == "") ? 5 : stoi(string_N);
cout << "Number of colors : "; cout << "Number of colors (default=8) : ";
int M; cin >> M; string string_M; getline(cin, string_M);
int M = (string_M == "") ? 8 : stoi(string_M);
cout << "Who plays [" << HUMAN << "/" << BOT << "] : "; cout << "Who plays [" << UNDERLINE << HUMAN << BACK << "/" << BOT << "] : ";
string player; cin >> player; string player; getline(cin, player);
if(player == "") player = HUMAN;
bool learn = 0; bool learn = 0;
if(player == HUMAN) { if(player == HUMAN) {
cout << "Do you want to know what bot learns [y/n] : "; cout << "Do you want to know what bot learns [" << UNDERLINE << "y" << BACK << "/n] : ";
string reply; cin >> reply; string reply; getline(cin, reply);
if(reply == "") reply = "y";
learn = (reply == "y"); learn = (reply == "y");
} }