#include
#include
void PrintIntroduction()
{
// Print welcome message to the terminal
std::cout << "\n**********************************************************************************************************************************************\n";
std::cout << " ____\n";
std::cout << " _,-ddd888888bbb-._\n";
std::cout << " d88888888888888888888b\n";
std::cout << " d888888888888888888888888b\n";
std::cout << "6888888888888888888888888889\n";
std::cout << "\"68888b8""8q8888888p8*""8d88889\n\"";
std::cout << "`d8887 p88888q 4888b'\n";
std::cout << " `d8887 p88888q 4888b'\n";
std::cout << " `d887 p88888q 488b'\n";
std::cout << " `d8bod8888888dob8b'\n";
std::cout << " `d88888888888d'\n";
std::cout << " `d8888888b' \n";
std::cout << " `d8888b' \n";
std::cout << " `bd'\n";
std::cout << "*************************************************************************************************************************************************\n*\n*";
std::cout << " Greetings, Agent. Welcome to TripleX. We are an Anti-Extraterrestrial Task Force tasked with defending our planet from an invisible threat.\n*";
std::cout << " Currently, one of our own has been captured by the alien threat. This operative has vital details about the nature of our operation, and must be recovered immediately.\n*";
std::cout << " In order to rescue our operative, you must bypass this facility's security measures...\n*";
}
// Removed PrintIntroduction from Terminal after each input
bool PlayGame(int Difficulty)
{
// Declare LevelDifficulty
std::cout << "\n**********************************************************************************************************************************************\n*\n*";
std::cout << " You are currently infiltrating a level " << Difficulty << " facility.\n*";
// Declare 3 number code
const int CodeA = rand() % Difficulty + Difficulty;
const int CodeB = rand() % Difficulty + Difficulty;
const int CodeC = rand() % Difficulty + Difficulty;
int CodeSum = CodeA + CodeB + CodeC;
int CodeProduct = CodeA * CodeB * CodeC;
// Print sum and product to the terminal
std::cout << " + There are three numbers in the code\n*";
std::cout << " + The codes add-up to: " << CodeSum;
std::cout << "\n* + The codes multiply to give: " << CodeProduct << std::endl << "*\n* ";
// Store player Guess
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
// Check if player's guess is correct
if (GuessSum == CodeSum && GuessProduct == CodeProduct)
{
std::cout << "*\n* Code verified, proceed to the next objective.\n";
return true;
}
else
{
std::cout << "*\n* Incorrect code, try again.\n";
return false;
}
}
int main()
{
srand(time(NULL));
int LevelDifficulty = 1;
int const MaxDifficulty = 5;
PrintIntroduction();
while (LevelDifficulty <= MaxDifficulty) // Loop game until all levels are completed
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear(); // Clears any errors
std::cin.ignore(); // Discards the buffer
if (bLevelComplete)
{
++LevelDifficulty;
}
}
// Print Win Message
std::cout << "***********************************************************************************************************************************************\n";
std::cout << "* Our agent has been secured, standby for evac!\n*\n* Congratulations, you win!\n";
std::cout << "***********************************************************************************************************************************************";
return 0;
}