I dont know if im just supposed to like…copy and paste it or what but thats what im doing
#include
#include
void PrintIntroduction(int Difficulty)
{
std::cout << std::endl;
std::cout << "\nEventually, you come across a large stone door with dwarven markings etched into the wall around it.";
std::cout << "\nIn the center of the door, you see the number " << Difficulty;
std::cout << " written in common.";
std::cout << "\nYou check your elven translation book, and you see the markings read:";
std::cout << "\n'In order to proceed, you must first prove yourself wise enough to be deemed worthy'";
std::cout << std::endl;
}
bool PlayGame(int Difficulty)
{
PrintIntroduction(Difficulty);
// Declare 3 number code
const int MarkingA = rand() % Difficulty + Difficulty;
const int MarkingB = rand() % Difficulty + Difficulty;
const int MarkingC = rand() % Difficulty + Difficulty;
const int MarkingSum = MarkingA + MarkingB + MarkingC;
const int MarkingProduct = MarkingA * MarkingB * MarkingC;
// Print sum and product to the terminal
std::cout << std::endl;
std::cout << "Each door will require a password, comprised of no less, and no more, than 3 numbers";
std::cout << "\nThe numbers, when added together, become " << MarkingSum;
std::cout << "\nAnd when combined through multiplication, you will receive " << MarkingProduct << std::endl;
std::cout << std::endl;
// Store Player Guess
int GuessA, GuessB, GuessC;
std::cin >> GuessA >> GuessB >> GuessC;
std::cout << std::endl;
std::cout << "You hear a voice echo from within the cavern. 'Your answer is " << GuessA << ", " << GuessB << ", and " << GuessC << " is it?' \n";
int GuessSum = GuessA + GuessB + GuessC;
int GuessProduct = GuessA * GuessB * GuessC;
// Check if player guess is corretct
if (GuessSum == MarkingSum && GuessProduct == MarkingProduct)
{
std::cout << "Theres a long pause...Suddenly, you hear banging and clicking from behind the door, as it starts to open, revealing the next section of the cavern.";
return true;
}
else
{
std::cout << "'I knew you were not worthy'";
return false;
}
std::cout << std::endl;
}
int main()
{
srand(time(NULL)); // Creates new random sequence based on time of day
std::cout <<"\n\nAfter accepting a contract from the job board at the local guild house, you set off to find the ancient elven ruins";
std::cout << std::endl;
std::cout << "\nYou travel for a couple of hours, until finally you see the entrance of a cavern in the distance";
std::cout << "\nCarefully, you enter the cavern, which is dimly lit aside from the faint glow eminating off of some strange crystals on the roof of the cave";
int const MaxLevel = 6;
int LevelDifficulty = 1;
while (LevelDifficulty < MaxLevel) // 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;
}
}
if (LevelDifficulty = MaxLevel)
{
std::cout <<"\nAs you step through the door, you see a large, dark room. A single beam of light shines down from a hole in the ceiling";
std::cout <<" on a pedestal in what you assume to be the center of the room.";
std::cout <<"\nYou hear a voice say 'You are worthy'";
std::cout <<"\nOn the pedestal, you see an old skull with one large ruby implanted in the left eye socket.";
std::cout <<"\nYou take the skull back to the guild, and collect your reward.";
std::cout <<"\nCongratulations, you have completed your quest!";
}
return 0;
}