Bomb Defusal tripleX Game w/ ASCII Art on lost game

#include <iostream>

void LossGraphic()
{
    //This is the graphic if the player loses
    std::cout << "          _ ._  _ , _ ._\n";
    std::cout << "        (_ ' ( `  )_  .__)\n";
    std::cout << "      ( (  (    )   `)  ) _)\n";
    std::cout << "     (__ (_   (_ . _) _) ,__)\n";
    std::cout << "         `~~`\\ ' . /`~~`\n";
    std::cout << "              ;   ;\n";
    std::cout << "              /   \\ \n";
    std::cout << "_____________/_ __ \\_____________\n";
}
void PrintIntroduction()
{
    //This is the text setup for the game
    std::cout << "The bomb defuser turns to you and yells,\n";
    std::cout << "\"We need to cut the correct wires to stop the bomb!\"\n";
}
void PlayGame()
{
    //Declare the 3 number code
    const int WireA = 2;
    const int WireB = 3;
    const int WireC = 4;

    const int WireSum = WireA + WireB + WireC;
    const int WireProduct = WireA * WireB * WireC;

    /*
    This is a multiline comment
    boop
    */

    //Print WireSum and WireProduct to terminal
    std::cout << "\nThere are 3 numbered wires to cut.\n";
    std::cout << "The sum of the numbers is " << WireSum << ".\n";
    std::cout << "The numbers mulitplied together equal " << WireProduct << ".\n";
    std::cout << "What number wire should they cut? ";

    //initialise the player's guess
    int PlayerGuessA, PlayerGuessB, PlayerGuessC;

    //Input & display the player's guess
    std::cin >> PlayerGuessA >> PlayerGuessB >> PlayerGuessC;
    std::cout << "\"Cut the #" << PlayerGuessA << " " << PlayerGuessB << " " << PlayerGuessC;
    std::cout << " wire!\" You yell.\n";
    
    //Declare the sum & product
    int GuessSum = PlayerGuessA + PlayerGuessB + PlayerGuessC;
    int GuessProduct = PlayerGuessA * PlayerGuessB * PlayerGuessC;

    //Win & lose conditions (check for correct guess)
    if (GuessSum == WireSum && GuessProduct == WireProduct)
    {
        std::cout << "You live to snip another day!";
    }
    else
    {
        std::cout << "You've snipped the wrong wire, better start running!\n";
        LossGraphic();
    }
}

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

Wow the ASCII art is really good.

I like how you added art for the lose condition, very nicely done.

Privacy & Terms