#include <iostream>
void OpeningScreen()
{
/* Welcome Messages */
std::cout << " _______________" << std::endl;
std::cout << "|,----------. |\ " << std::endl;
std::cout << "|| |=| |" << std::endl;
std::cout << "|| || | |" << std::endl;
std::cout << "|| . _o| | | " << std::endl;
std::cout << "|`-----------' |/ " << std::endl;
std::cout << " ~~~~~~~~~~~~~~~ " << std::endl;
std::cout << "Shadow Run TripleX Code" << std::endl;
std::cout << std::endl;
std::cout << "+ Apollo: 'Welcome, Runner. I am Apollo.' \n";
}
void PrintIntroduction(int Difficulty)
{
std::cout << "+ Apollo: 'I have a job for you. I need you to crack into a level " << Difficulty << " file vault in the Matrix.'\n";
std::cout << "+ Apollo: 'Crack the code, get the files, get paid. That easy, right? Let's hope so.' \n\n";
}
bool PlayGame(int Difficulty)
{
PrintIntroduction(Difficulty);
/* Declare 3 number code */
const int CodeA = 4;
const int CodeB = 7;
const int CodeC = 9;
const int CodeSum = CodeA + CodeB + CodeC;
const int CodeProduct = CodeA * CodeB * CodeC;
/* Print sum and product to the terminal */
std::cout << "+ Apollo: 'So, apparently the pin to the locked files is only three numbers. Easy enough.' \n";
std::cout << "+ Apollo: 'While I could not get the code itself, I did manage to get some hints. Apparetly the pin adds up to " << CodeSum << ".'\n";
std::cout << "+ Apollo: 'Also apparently if you multiply them ya get " << CodeProduct << ".'\n";
/* "cin" stores players code */
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
const int GuessSum = GuessA + GuessB + GuessC;
const int GuessProduct = GuessA * GuessB * GuessC;
/* Checks if player is correct or not */
if (GuessSum == CodeSum && CodeProduct == CodeProduct)
{
std::cout << "\n+ Apollo: '" << GuessA << GuessB << GuessC << " is right! We're in. I will contact you with the next update when ready.'\n\n";
return true;
}
else
{
std::cout << "\n+ Apollo: 'That code is wrong! The cops will be on to us if you keep that up. I'll contact you again later with another vault. '\n\n";
return false;
}
}
int main()
{
int LevelDifficulty = 1;
const int MaxDifficulty = 10;
OpeningScreen();
while (LevelDifficulty <= MaxDifficulty) // Loop game until all levels are completed
{
bool bLevelComplete = PlayGame(LevelDifficulty);
std::cin.clear();
std::cin.ignore();
if (bLevelComplete)
{
++LevelDifficulty;
}
}
std::cout << "+ Apollo: 'That was the final code. Good work, Runner. Your payment will be wired to you by the end of the week.' ";
return 0;
}
My game so far! I even added a Opening Screen Function for my ACII art and a bit more opening text so it does not repeat the welcome and the title each time.