#include #include #include #include using namespace std; enum class ResultT:unsigned char {YELLOW_SIGN, TENTACLE, ELDER_SIGN, CTHULHU, EYE, UNKNOWN}; const ResultT FIRST_RESULT = ResultT::YELLOW_SIGN; const size_t RESULT_RANGE = static_cast(ResultT::UNKNOWN) - static_cast(ResultT::YELLOW_SIGN); string ResultTToString(ResultT value); ResultT NextResultT(ResultT value); string MakeUpper(string value); ResultT StringToResultT(string value); ResultT RollDie(); enum class StatusT { ALIVE, INSANE, UNKNOWN}; const StatusT FIRST_STATUS = StatusT::ALIVE; string StatusTToString(StatusT status); StatusT Next(StatusT status); const int MAX_SANITY = 18; struct PlayerT { string name; int sanity; StatusT status; }; void PrintPlayer(PlayerT player); void Battle(PlayerT & attacker, PlayerT & victim, int & chtulhu); PlayerT GetPlayer(int & cthulhu); int main() { int cthulhu = MAX_SANITY; PlayerT player1, player2; player1 = GetPlayer(cthulhu); player2 = GetPlayer(cthulhu); PrintPlayer(player1); PrintPlayer(player2); Battle(player1, player2, cthulhu); PrintPlayer(player1); PrintPlayer(player2); return 0; } void PrintPlayer(PlayerT player){ } void Battle(PlayerT & attacker, PlayerT & victim, int & chtulhu){ } PlayerT GetPlayer(int & cthulhu){ PlayerT player; return player; } string StatusTToString(StatusT status){ string result; switch (status) { case StatusT::ALIVE: result = "Alive"; break; case StatusT::INSANE: result = "Insane"; break; case StatusT::UNKNOWN: default: result = "UNKNOWN"; break; } return result; } StatusT Next(StatusT status){ StatusT result = StatusT::UNKNOWN; if (status < StatusT::UNKNOWN) { result = static_cast(static_cast(status) + 1); } return result; } ResultT NextResultT(ResultT value) { ResultT result = ResultT::UNKNOWN; if (value != ResultT::UNKNOWN) { result = static_cast(static_cast(value) + 1) ; } return result; } string ResultTToString(ResultT value) { string result; switch (value) { case ResultT::YELLOW_SIGN: result = "Yellow Sign"; break; case ResultT::TENTACLE: result = "Tentacle"; break; case ResultT::ELDER_SIGN: result = "Elder Sign"; break; case ResultT::CTHULHU: result = "Cthulhu"; break; case ResultT::EYE: result = "EYE"; break; case ResultT::UNKNOWN: [[fallthrough]]; default: result = "Unknown Result"; } return result; } string MakeUpper(string value) { size_t i; for(i = 0; i < value.size(); i++) { value[i] = static_cast(toupper(value[i])); } return value; } ResultT StringToResultT(string value){ value = MakeUpper(value); ResultT result = ResultT::UNKNOWN; if (value == "YELLOW SIGN") { result = ResultT::YELLOW_SIGN; } else if (value == "TENTACLE") { result = ResultT::TENTACLE; } else if (value == "ELDER SIGN") { result = ResultT::ELDER_SIGN; } else if (value == "CTHULHU") { result = ResultT::CTHULHU; } else if (value == "EYE") { result = ResultT::EYE; } return result; } ResultT RollDie(){ ResultT result = ResultT::UNKNOWN; int roll; roll = rand() % 12; if (roll < 5) { result = ResultT::YELLOW_SIGN; } else if (roll < 9) { result = ResultT::TENTACLE; } else if (roll == 9) { result = ResultT::ELDER_SIGN; } else if (roll == 10) { result = ResultT::CTHULHU; } else if (roll == 11) { result = ResultT::EYE; } else { result = ResultT::UNKNOWN; } return result; }