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 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<int> response) {
return YELLOW + to_string(response[0]) + BACK + " / " +

View file

@ -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");
}