Triplex Dungeon of Exploding Chests

#include <iostream>
void PrintIntroduction()
{
    //Print welcome messages to terminal
    std::cout << "Welcome to the Dungeon of Exploding Treasure Chests.\n";
    std::cout << "     _                                    \n" << 
                 "    | |                                   \n";
    std::cout << "  __| |_   _ _ __   __ _  ___  ___  _ __  \n"
               <<" / _` | | | | '_ > / _` |/ _ >/ _ >| '_ > \n";
    std::cout << "| (_| | |_| | | | | (_| |  __/ (_) | | | |\n" 
              << " <__,_|<__,_|_| |_|<__, |<___|<___/|_| |_|\n";
    std::cout << "                    __/ |                 \n" 
            <<   "                  |_____/                  \n";
    std::cout << "You must enter the correct numbers of this 3 digit lock to get into this treasure chest.\n";
    std::cout << "Once correct you may enter the next room and open another treasure chest....\n\n\n";
}
void PlayGame()
{
    const int CodeA = 4;
    const int CodeB = 5;
    const int CodeC = 6;

    const int CodeSum = CodeA + CodeB + CodeC;
    const int CodeProduct = CodeA * CodeB * CodeC;

    // Print CodeSum and CodeProduct to terminal
    std::cout << "+ There are 3 codes to unlock the chest";
    std::cout << "\n+ The codes add-up to: " << CodeSum;
    std::cout << "\n+ The codes multiply to give: " << CodeProduct << std::endl;

    int GuessA, GuessB, GuessC;
    std::cin >> GuessA >> GuessB >> GuessC;

    int GuessSum = GuessA + GuessB + GuessC;
    int GuessProduct = GuessA * GuessB * GuessC;

    if (CodeSum == GuessSum && CodeProduct == GuessProduct)
    {
        std::cout << "KE-CHA! You unlocked the treasure chest!\n"
                  << "         <>_________________________________\n" 
                  << "[########[]_________________________________>\n" 
                  << "         <>\n"
                  << "And received EXCALIBUR! Well done you may proceed to the next room.\n";
    }  
    else
    {
        std::cout << "     DOKA!\n" 
                  << "      _L_\n" 
                  << "    ,\"   \".\n" 
                  << "(> /  O O  > /) \n" 
                  << " <|    _    |/\n"
                  << "   <  (_)  /\n" 
                  << "   _/.___,>_\n" 
                  << "  (_/     >_)\n" 
                  << "The treasure chest exploded!!!!!! You died.";
    }

}

int main()
{
    PrintIntroduction();
    PlayGame();
    return 0;
}

I had a lot of fun with the ASCII art, even though all of it was copy and paste. there were some part that didn’t work. but i got it worked out in the end. :).

Privacy & Terms