38 logo.emplace_back(R
"( __ __)");
39 logo.emplace_back(R"( | \ | \)");
40 logo.emplace_back(R"( _______ _| $$_ ______ _______| $$ __)");
41 logo.emplace_back(R"( / | $$ \ / \ / | $$ / \)");
42 logo.emplace_back(R"(| $$$$$$$\$$$$$$ | $$$$$$| $$$$$$| $$_/ $$)");
43 logo.emplace_back(R"( \$$ \ | $$ __| $$ | $| $$ | $$ $$)");
44 logo.emplace_back(R"( _\$$$$$$\ | $$| | $$__/ $| $$_____| $$$$$$\)");
45 logo.emplace_back(R"(| $$ \$$ $$\$$ $$\$$ | $$ \$$\)");
46 logo.emplace_back(R"( \$$$$$$$ \$$$$ \$$$$$$ \$$$$$$$\$$ \$$)");
47 logo.emplace_back(R"( __ __)");
48 logo.emplace_back(R"( | \ | \)");
49 logo.emplace_back(R"( ______ ____ ______ ______ | $$ __ ______ _| $$_)");
50 logo.emplace_back(R"(| \ \ | \ / \| $$ / \/ | $$ \)");
51 logo.emplace_back(R"(| $$$$$$\$$$$\ \$$$$$$| $$$$$$| $$_/ $| $$$$$$\$$$$$$)");
52 logo.emplace_back(R"(| $$ | $$ | $$/ $| $$ \$| $$ $$| $$ $$| $$ __)");
53 logo.emplace_back(R"(| $$ | $$ | $| $$$$$$| $$ | $$$$$$\| $$$$$$$$| $$| \)");
54 logo.emplace_back(R"(| $$ | $$ | $$\$$ $| $$ | $$ \$$\\$$ \ \$$ $$)");
55 logo.emplace_back(R"( \$$ \$$ \$$ \$$$$$$$\$$ \$$ \$$ \$$$$$$$ \$$$$)");
56 logo.emplace_back(R"( __ __ __)");
57 logo.emplace_back(R"( | \ | \ | \)");
58 logo.emplace_back(R"( _______ \$$______ ____ __ __| $$ ______ _| $$_ ______ ______)");
59 logo.emplace_back(R"( / | | \ \| \ | | $$| | $$ \ / \ / \)");
60 logo.emplace_back(R"(| $$$$$$| $| $$$$$$\$$$$| $$ | $| $$ \$$$$$$\$$$$$$ | $$$$$$| $$$$$$\)");
61 logo.emplace_back(R"( \$$ \| $| $$ | $$ | $| $$ | $| $$/ $$| $$ __| $$ | $| $$ \$$)");
62 logo.emplace_back(R"( _\$$$$$$| $| $$ | $$ | $| $$__/ $| $| $$$$$$$| $$| | $$__/ $| $$)");
63 logo.emplace_back(R"(| $| $| $$ | $$ | $$\$$ $| $$\$$ $$ \$$ $$\$$ $| $$)");
64 logo.emplace_back(R"( \$$$$$$$ \$$\$$ \$$ \$$ \$$$$$$ \$$ \$$$$$$$ \$$$$ \$$$$$$ \$$ )");
75 cout <<
"Enter player name:" << endl;
78 while ((filesystem::exists(foldername) ||
playerName.find(
' ') != string::npos) ||
81 cout <<
"Invalid Playername. ";
82 cout <<
"Playername should not contain spaces or cannot be the same as "
84 cout <<
"playername" << endl <<
"Please enter a new player name: " << endl;
89 filesystem::create_directory(foldername);
93 std::string filesave =
96 fin.open(filesave.c_str());
99 hsi_history.emplace_back(hsi);
110 fout.open(stocksave.c_str());
114 for (
unsigned long i = 0; i < stocks_list.size(); i++) {
125 vector<string> players;
126 filesystem::create_directory(
129 if (players.empty()) {
130 cout <<
"No player saves found, please create a new player." << endl;
134 cout <<
"Enter player name from the following:" << endl;
136 while (std::find(players.begin(), players.end(),
playerName) ==
139 cout <<
"Player name does not exist, please enter a new name from the "
148 fin.open(stockload.c_str());
164 vector<string> players;
165 filesystem::create_directory(
168 if (players.empty()) {
182 cout <<
"Enter player name from the following:" << endl;
184 while (std::find(players.begin(), players.end(), inputname) ==
186 if (!inputname.empty()) {
187 cout <<
"Player name does not exist, please enter a new name from the "
192 getline(cin, inputname);
195 cout <<
"WARNING! This action is irreversible and will delete all data associated "
196 "with the player save."
198 cout <<
"Player save " << inputname
199 <<
" is going to be deleted, please enter Y to confirm" << endl;
201 if (confirm ==
"Y" || confirm ==
"y") {
203 for (
const auto & path : std::filesystem::directory_iterator(stockdel)) {
204 std::filesystem::remove(path);
206 std::filesystem::remove_all(stockdel);
207 cout <<
"Player save " << inputname <<
" has been deleted." << endl;
210 cout <<
"The deletion has been cancelled." << endl;
215 vector<string> saves;
225 for (
unsigned long i = 1; i < avector.size(); i++) {
226 cout <<
", " << avector[i];
static const std::string DELETE_GAME
static const std::string EXIT_GAME
static const std::string NEW_GAME
static const std::string LOAD_GAME
void loadstatus(unsigned int &rounds_played, vector< Stock > &stocks_list, float &balance, string &playerName, vector< float > &hsi_history)
Load an existing game status from .save files.
const std::string USER_SAVE_OPTION_PROMPT
vector< string > parseLogo(void)
returns the game logo, which is hardcoded inside the function.
void delsave(string &mode)
Delete a save.
void createplayer(string &playerName)
Create a player folder.
void printvector(const vector< string > &avector)
Print the vector of saves aka player folders.
void load_hsi(std::vector< float > &hsi_history, const string &playerName)
void savestatus(unsigned int rounds_played, vector< Stock > stocks_list, float balance, const string &playerName)
Save the game status into *.save files.
vector< string > get_saves(void)
Get the list of saves aka player folders.
Header files for file operation functions related to the game.
const std::string SAVE_FOLDER_PREFIX
const std::string SAVE_FILE_EXTENSION_TXT
mode
hiding mean/sd/uplim/lowlim/event_id columns in the table
float balance
Player's balance.
unsigned int rounds_played
Number of rounds played.
std::string playerName
Player's name.
const int initial_stock_count
Initial stock count.