3xX Game with ASCII

The works so far looks like that:


BUT!! There is Immersion added in the code xD (The intro types letter by letter :smiley: ):

/* This is just sample game made based on course from Udemy for XXX_Game :wink: */

#include <iostream>

#include <windows.h> //to make game more immersive kappa

//immersion starts

void TypeALine (std::string Line, int LineLength) {

    const int TimeTraveler = 50;

    for (int Letter =0; Letter<LineLength ; Letter++){

            std::cout << Line[Letter];

            Sleep(TimeTraveler);

    }

}

//immersion ends

void PrintIntroduction () {

    std::string LinesForPrint [4] = {

    "You messed up your code, and now you need to access long forgotten encrypted storage where you keep the backup,\n",

    "Luckily for you, even though you couldn't remember password to it, you left yourself a backdoor....\n \n",

    "At the time you thougth little math game would prevent unwelcome people from accessing your backups,\n",

    "But will you be able to access it yourself?"

    };

    int LengthOfLines [4];

    LengthOfLines[0] = LinesForPrint[0].length();

    LengthOfLines[1] = LinesForPrint[1].length();

    LengthOfLines[2] = LinesForPrint[2].length();

    LengthOfLines[3] = LinesForPrint[3].length();

    std::cout << "=========================" << std::endl;

    std::cout << "||                     ||" << std::endl;

    std::cout << "||          ^          ||" << std::endl;

    std::cout << "|| <-- -- --+-- -- --> ||" << std::endl;

    std::cout << "||      //BUGS//       ||" << std::endl;

    std::cout << "||   --Everywhere--    ||" << std::endl;

    std::cout << "||                     ||" << std::endl;

    std::cout << "|| bool print = false; ||" << std::endl;

    std::cout << "||_____________________||" << std::endl;

    

    for (int Lines = 0; Lines<4; Lines++){

        TypeALine (LinesForPrint[Lines], LengthOfLines[Lines]);

    }

        

}

void PlayGame () {

    PrintIntroduction();

//variable declarations are here

    int Code[3] = {2, 3, 4};

    int PlayerGuess[3];

    int GuessSum, GuessProduct;

//int CodeSum = CodeA+CodeB+CodeC;

    int CodeSum = Code[0]+Code[1]+Code[2];

    int CodeProduct = Code[0]*Code[1]*Code[2];

//print Sum and Multiply values of 3 Codes

    std::cout << "There are 3 codes in the system: \n";

    std::cout << "- Sum of which is: " << CodeSum << std::endl;

    std::cout << "- And if you multiply them you get: " << CodeProduct << std::endl << std::endl;

//Guessing starts here

    std::cout << "Now, enter your guess: ";

    for (int GuessCount=0; GuessCount<3; GuessCount++)

    {

        std::cin >> PlayerGuess[GuessCount];

    }

    GuessSum = PlayerGuess[0] + PlayerGuess[1] + PlayerGuess[2];

    GuessProduct = PlayerGuess[0] * PlayerGuess[1] * PlayerGuess[2];

    if (CodeSum == GuessSum && CodeProduct == GuessProduct)

    {

        std::cout << "You guessed Right\n ";

    } else {

        std::cout << "You Guessed Wrong\n ";

    }

}

int main()

{

    PlayGame();

    return 0;

}

Privacy & Terms