Simpossible: Up To Date

Hello all! I just wanted to post an updated version of my game Simpossible on my site. This is the progress I have made as of 6PM January 23rd 2019! I put a fair amount of effort into commenting on pretty much most operations within to code to make it easily browsed by all, so I hope you all are able to enjoy!

//
//  main.cpp
//  Simpossible
//
//  Created by Aidan Takami on 8/31/18.
//  Copyright © 2018 Aidan Takami. All rights reserved.
//

#include <iostream>
#include <string>
#include <iomanip>
#include <unistd.h>
#include <chrono>
#include <ctime>
#include <cstdlib>



// Define Clock
typedef std::chrono::high_resolution_clock Clock;

// Namespace
using namespace std;


// Methods
int newGame();
void miniGame(int difficulty);
bool mathGame(int difficulty);
bool repeatAfterMe(int difficulty);
bool letsDance(int difficulty);
bool romanNumerals(int difficulty);


/*
 
        Fields
 
 */


//Strings
string wordsOfWisdom();
string incorrectAnswer();
string correctAnswer();

//Longs
long highScore;
long score;

//Ints
int lives;
int tempScore;



/*
    
    Main Function
 
 */

int main() {
    
    // Introduction
  
    // GoTo marker
top:
    
    
    
    cout << "                Welcome one and welcome all to" << endl << endl;
    sleep(2);
    cout << "                          SIMPOSSIBLE       " << endl<<endl<<endl;
    sleep(2);
    cout << "The rules are straightforward. The faster you answer, the more points you recieve." << endl << endl;
    sleep(3);
    cout << "You have 3 lives, and things will get harder the farther you make it." << endl << endl;
    sleep(2);
    cout << "That's pretty much it... ";
    sleep(1);
    cout << wordsOfWisdom() << endl << endl;
    sleep (3);
    cout << "Go ahead and [Press Enter] to begin!" << endl;
    cout << "High Score: " << highScore;
    
    
    
    // Begins game when user presses enter
    if (cin.get() == '\n'){
        
        
        // Clears screen without the use of System() (Oh wow, cross platform compatibility! Simpossible for all!)
        cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;
        cout << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl << endl;

        
        // Let the games begin!
        tempScore = newGame();
    }
    
    
    // Endgame process
    
    // Checks for highscore and restarts game
    if (tempScore > highScore) highScore = tempScore;
    
    // Clears the user input to prepare for next game
    cin.clear();
    
    // Redirects to intro
    goto top;

}


/*

    New Game
 
*/



// The start of a new game
int newGame(){
    
    // Initializing variables/ Assigning values to fields
    score = 0;
    lives = 3;
    int difficulty = 0;
    int round = 0;

    // While user still has lives: EXECUTE!
    while(lives > 0){
        
        
        // Calls to the minigame deciding method
        miniGame(difficulty);
        
        // int round is used to keep track of total games played
        round++;
        
        // Every 5 minigames, difficulty will increase
        if(round % 5 == 0){
           
            // Increments dificulty
            difficulty++;
            
            
            // Notification to user
            cout << endl << endl << endl << "Difficulty Up!" << endl << endl;
            cout << wordsOfWisdom() << endl << endl << endl;;
            sleep(5);
        }
    }
    
    // Returns the score after game
    return score;
}



/*
 
    MiniGame Method
 
 */




// Method to deliver the games to the user
void miniGame(int difficulty){
    
    // Seeds Rand
    srand ( time(0) );
    
    
    // random int generator (Lots of these bad boys to be found in this code!)
    int random = rand() % 4;
    bool correct = false;
    
    // Starts timer for score
    auto start = Clock::now();
    long duration;
    
    // Math Game
    if(random == 0){
        
        // If answer correct, bool correct is flipped to true
        if (mathGame(difficulty)){
            correct = true;
        }
    }
    
    // Repeat after me game
    else if(random == 1){
        
        // If response was correct, bool correct is flipped (like a switch) to true
        if(repeatAfterMe(difficulty)){
            correct = true;
        }
    }
    
    // Lets dance game
    else if(random == 2){
        
        // If response was correct, YOU GUESSED IT, bool correct is flipped to true
        if(letsDance(difficulty)){
            correct = true;
        }
    }
    
    // Roman numerals game
    else if(random == 3){
        
        // If response was correct, bool correct is flipped to false.... orange ya glad I didnt say true?
        // Just kidding it's flipped to true. but you knew that.
        if(romanNumerals(difficulty)){
            correct = true;
        }
    }
    
    
    // Creates a variable of the time the problem is finished
    auto howLong = Clock::now();
    
    
    // Gives the duration variable a value
    duration = std::chrono::duration_cast<std::chrono::milliseconds>(howLong - start).count();

    
    // Calculates the score of the round
    long roundScore = (10000 * (difficulty + 1)) - duration;
   
    // Makes Sure problem was done in under 10 Seconds
    if(duration < 10000 && correct){
        
        // Notifies user of score
        score += roundScore;
        cout << correctAnswer() << endl << " Score: " << score << endl << endl;
        sleep(3);
        
    }
    
    // If answer was correct, but took over 10 seconds
    else if(duration > 10000 && correct){
        
        // Doesn't take a life, but doesn't give addition to score
        cout << "You gotta be quicker than that.! " << endl << " Score: " << score << endl << endl;
    }
    
}


/*
 
 
    Math Game that tasks user with solving randomly generated math problems of increasing dificulty.
 
 
 */


// Math Game
bool mathGame(int difficulty){

    // Seeds Rand
    srand ( time(0) );

   
    /*
     
        Difficulty 0 - 2
     
     */
    
    if(difficulty <= 2){
        
        
        // Generates vars & decides operation
        int var1 = (rand() % 11) * (difficulty + 1);
        int var2 = (rand() % 11) * (difficulty + 1);
        int operation = rand() % 2;
        int answer;
        
        
        // Addition operation
        if(operation == 0){
            
           
            cout << var1 << " + " << var2 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != var1+var2){
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
        }
        
        // Subtraction operation
        else if(operation == 1){
            
            
            cout << var1 << " - " << var2 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != var1-var2){
               
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;

        }
    }
    
    
    /*
     
        Difficulty 3 - 6
     
     */
    
    
    // Increase in difficulty
    else if(difficulty > 2 && difficulty <= 6){
        
        
        // Creates random vars & decides operation. The random vars increase in size as the difficulty goes up.
        int var1 = (rand() % (20 + difficulty));
        int var2 = (rand() % (20 + difficulty));
        int var3 = (rand() % (20 + difficulty));
        int operation = rand() % 2;
        int answer;
        
        
        // Addition operation
        if(operation == 0){
            
            
            cout << var1 << " + " << var2 << " + " << var3 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != var1+var2+var3){
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
        }
        
        // Subtraction operation
        else if(operation == 1){
            
            
            cout << var1 << " - " << var2 <<  " + " << var3 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != (var1-var2)+var3){
                
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
            
        }

        
        
        
        
    }
    
    
    /*
     
     Difficulty 7 - 10
     
     */
    
    
    // Increase in difficulty
    else if(difficulty > 6 && difficulty <= 10){
        
        
        // Creates random vars & decides operation. The random vars increase in size as the difficulty goes up.
        int var1 = (rand() % (20 + difficulty));
        int var2 = (rand() % (20 + difficulty));
        int var3 = (rand() % (20 + difficulty));
        int operation = rand() % 3;
        int answer;
        
        
        // Addition operation
        if(operation == 0){
            
            
            cout << var1 << " + " << var2 << " + " << var3 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != var1+var2+var3){
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
        }
        
        // Subtraction operation
        else if(operation == 1){
            
            
            cout << var1 << " - " << var2 <<  " + " << var3 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != (var1-var2)+var3){
                
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
            
        }
        
        // Multiplication Operation
        else if(operation == 2){
            
            
            // Lowers random vars for sake of solvability... like you need that... smartie pants
            var1 -= 15;
            var2 -= 15;
            
            cout << var1 << " * " << var2 << " = ";
            cin >> answer;
            
            // Wrong answer
            if(answer != (var1*var2)){
                
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct
            else return true;
        }
    }
    
    
    /*
     
     Difficulty 11+
     
     */
    
    
    // Increase in difficulty
    else if(difficulty > 10){
        
        
        // Creates random vars & decides operation. The random vars increase in size as the difficulty goes up.
        int var1 = (rand() % (20 + difficulty));
        int var2 = (rand() % (20 + difficulty));
        int var3 = (rand() % (20 + difficulty));
        int operation = rand() % 4;
        int answer;
        
        
        // Addition operation
        if(operation == 0){
            
            
            cout << var1 << " + " << var2 << " + " << var3 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != var1+var2+var3){
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
        }
        
        // Subtraction operation
        else if(operation == 1){
            
            
            cout << var1 << " - " << var2 <<  " + " << var3 << " = ";
            cin >> answer;
            
            // Wrong Answer
            if(answer != (var1-var2)+var3){
                
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct Answer
            else return true;
            
        }
        
        // Multiplication Operation
        else if(operation == 2){
            
            
            // Lowers random vars for sake of solvability.
            var1 -= 15;
            var2 -= 15;
            var3 -= 15;
            
            cout << var1 << " * " << var2 << " * " << var3 << " = ";
            cin >> answer;
            
            // Wrong answer
            if(answer != (var1*var2*var3)){
                
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct
            else return true;
        }
        
        // PemDas Operation
        else if(operation == 3){
            
            
            var1 -= 15;
            
            cout << var1 << "(" << var2 << " + " << var3 << ") = ";
            cin >> answer;
            
            // Wrong answer
            if(answer != ((var2+var3)*var1)){
                
                lives--;
                cout << incorrectAnswer() << " You have " << lives << " lives left." << endl << endl;
                sleep(3);
                return false;
            }
            
            // Correct
            else return true;
            
        }
    }

        

    
    return false;
}



/*
 
    Repeat After Me, the program will create a random string which the user must replicate. difficulty increases 
 size of the string. The string could even end up as long as this comment, if youre really good at this game.
 
 
 Dev tip for those who are this far along in reading the code:
 
    Since you dont lose a life for a correct answer over the time limit, always make sure your answer
 is correct before submitting it. That's how you make it far in this game! Perfection!!!
 Don't ever say I didn't do anything for you!!
 
 */

// Repeat After Me Game
bool repeatAfterMe(int difficulty){
    
    // Basic instructions
    cout << "Repeat after me!! " << endl;
    sleep(2);
    
    // Initialize the varaiables
    char letter;
    string sentence;
    string answer;
    int temp;
        
        
    // Initialize random num generator
    srand (time(0));
    
    
    // Loop to increase size of repeat after me by difficulty
    for(int rep = 0; rep <= difficulty+3; rep++){
        
        // Generates random number
        temp = rand() % 26;
            
        // Converts number to letter
        letter = 'a' + temp;
        sentence += letter;
    }
    
    // Prints out the "sentence"
    cout << sentence << endl;
    
    // Takes user's input
    cin >> answer;
    
    // Compares the user's input to the specified string & returns true if correct
    if(answer == sentence) return true;
    
    
    else{
        
        
        // Incorrect :(
        lives --;
        cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
        
        // Returns false if wrong
        return false;
    }
}

/*
 
 
    Lets Dance is a game that will give a user directions to follow using their keyboard
 
 */

// Lets Dance!
bool letsDance(int difficulty){
    
    // Intro to the game
    cout << " Care to dance.? " << endl;
    cout << "(for the sake of cross OS playability, use your \'W\' \'A\' \'S\' and \'D\' keys as up left down and right, followed by ENTER!)" << endl;
    
    
    sleep(2);
    
    // Increments the number of directions according to the difficulty
    for(int rep = 0; rep <= difficulty+2; rep++){
    
        // Initialize random num generator & generates a random
        srand (time(0));
        int randomNum = rand()%12;
        
        
        // Decides what next move is using random num & checks for input
        // Multiple values added for each move to promote randomness
        
        
        // If random is 0, 9, or 11
        if(randomNum == 0 || randomNum == 9 || randomNum == 11){
            
            cout << "   LEFT   " << endl;
            
           // Correct Move
            char temp;
            cin >> temp;
            if(temp == 'a'){
              
                cout << endl;
            }
            
            // Wrong move
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;

            }
            
        }
        
        // If random is 1, 7, or 8
        else if(randomNum == 1 || randomNum == 7 || randomNum == 8){
            
            cout << "   FORWARD   " << endl;
            
            // Correct Move
            char temp;
            cin >> temp;
            if(temp == 'w'){
                
                cout << endl;

            }
            
            // Wrong move
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }

        }
        
        // If random is 2, 5, or 10
        else if(randomNum == 2 || randomNum == 5 || randomNum == 10){
            
            cout << "   RIGHT   " << endl;
            
            // Correct Move
            char temp;
            cin >> temp;
            if(temp == 'd'){
                
                cout << endl;

            }
            
            // Wrong move
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }

            
        }
        
        // If random is 3, 4, or 6
        else if(randomNum == 3 || randomNum == 4 || randomNum == 6){
            
            cout << "   BACK   " << endl;
            
            // Correct Move
            char temp;
            cin >> temp;
            if(temp == 's'){
                
                cout << endl;

            }
            
            // Wrong move
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }

            
        }
        
    }
    
    
    //Dance completed
    return true;
    
    
    
}




/*
 
    Roman Numeral ID will ask user to identify a roman numeral generated at random
 
 
 */

// Roman Numeral Identification
bool romanNumerals(int difficulty){
    
    // Start of game
    // Initialize roman numeral string to be appended
    string number;
    
    cout << "Hey, ID this Roman Numeral for me.?" << endl;
    
    sleep(3);

    // Difficulties below or equal to 1
    if(difficulty <= 1){
        
        // Seed & initialize rand
        srand(time(0));
        int randomNum = rand()% 5;
        
        // Ensures rand cant = 0
        if (randomNum == 0) randomNum += 3;
        
        // If rand is < 4, the numeral will only consist of "I"
        if(randomNum < 4){
            
            // Create the roman numeral up to 3
            for(int rep = 0; rep < randomNum; rep++){
                
                number += "I";
            }
            
            // Output numeral
            cout << number << endl;
            
            // Take user answer
            int temp;
            cin >> temp;
            
            
            // Correct Answer
            if (temp == randomNum){
                cout << endl;
            }
            
            // Wrong Answer
            else {
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;

            }
            
        }
        
        // If rand = 4
        else {
            
            // Outputs 4 in Roman Numerals
            cout << "IV" << endl;
            
            // Take user answer
            int temp;
            cin >> temp;
            
            // Correct Answer
            if(temp == 4){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;

            }
        }
    }
    
    // Difficulty > 1 && < or equal to 6
    else if(difficulty > 1 && difficulty <= 5){
        
        // seeds and initializes rand range 5 - 20
        srand(time(0));
        int randomNum = rand() % 20 + 6;
        
        
        // Rand = 5
        if(randomNum == 9){
            
            // Output
            cout << "IX" << endl;
            
            // User input
            int temp;
            cin >> temp;
            
            // Correct Answer
            if (temp == 9){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;

            }
        }
        
        // Rand = 14
        else if(randomNum == 14){
            
            // Output
            cout << "XIV" << endl;
            
            // User input
            int temp;
            cin >> temp;
            
            // Correct Answer
            if (temp == 14){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }
        }
        
        // Rand = 15
        else if(randomNum == 15){
            
            // Output
            cout << "XV" << endl;
            
            // User input
            int temp;
            cin >> temp;
            
            // Correct Answer
            if (temp == 15){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }
        }

        
        // Rand = 19
        else if(randomNum == 19){
            
            // Output
            cout << "IXX" << endl;
            
            // User input
            int temp;
            cin >> temp;
            
            // Correct Answer
            if (temp == 19){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }
        }


        
        // Rand = 6 - 20
        else{
            
            // If rand is directly divisible by 10
            if ((randomNum % 10) == 0){
               
                //Create a string which properly represents rand with Xs
                for (int rep = 0; rep < (randomNum/10); rep++){
                    
                    number += "X";
                }
                
                // Output
                cout << number << endl;
                
                // User input
                int temp;
                cin >> temp;
                
                // Correct Answer
                if(temp == randomNum){
                    cout << endl;
                }
                
                // Wrong Answer
                else{
                    
                    lives --;
                    cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                    
                    //returns false
                    return false;

                }
            }
            
            // If rand can be divided by 10 with a remainder less than 4
            else if((randomNum % 10) < 4 && randomNum > 10){
                
                //Starts numeral with a X
                number += "X";
                
                // Creates the random numeral
                for(int rep = 0; rep < (randomNum - 10); rep++){
                    
                    number += "I";
                }
                
                // Output
                cout << number << endl;
                
                // Input
                int temp;
                cin >> temp;
                
                // Correct Answer
                if (temp == randomNum){
                    cout << endl;
                }
                
                // Wrong Answer
                else{
                    
                    lives --;
                    cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                    
                    //returns false
                    return false;

                }
            }
            
            // If rand can be divided by 10 with a remaineder greater than 5
            else if((randomNum % 10) > 5 && randomNum > 15){
                
                // Starts numeral with a XV
                number += "XV";
                
                // Creates random numeral
                for(int rep = 0; rep < (randomNum - 15); rep++){
                    
                    number += "I";
                }
                
                // Output
                cout << number << endl;
                
                // Input
                int temp;
                cin >> temp;
                
                // Correct Answer
                if(temp == randomNum){
                    cout << endl;
                }
                
                // Wrong Answer
                else{
                    
                    lives --;
                    cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                    
                    //returns false
                    return false;
                    
                }
            }
            
            // If rand is not divisible by 10 at all, aka less than 10
            else if(randomNum > 5 && randomNum < 9){
                
                // Starts numeral with a V
                number += "V";
                
                // Creates the random numeral
                for(int rep = 0; rep < (randomNum - 5); rep++){
                    
                    number += "I";
                }
                
                // Output
                cout << number << endl;
                
                // Input
                int temp;
                cin >> temp;
                
                // Correct Answer
                if(temp == randomNum){
                    cout << endl;
                }
                
                // Wrong Answer
                else{
                    
                    lives --;
                    cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                    
                    //returns false
                    return false;

                }
            }
            
        }
    }
    
    // Difficulty above 6
    else if(difficulty > 6){
        
        // Seeds and initializes random number
        srand(time(0));
        int randomNum = rand() % 100 + 10;
        
        // Checks for base 50
        if((randomNum % 50) == 0){
            
            // Creates string for as many times as 50 goes into the number
            for(int rep = 0; rep < (randomNum/50); rep++){
                
                // Adds L to the string
                number += "L";
                
                // If the repetition is 1, the string will be cleared and "C" will be put instead
                if(rep == 1){
                    number.clear();
                    number += "C";
                }
                
            }
            
            // Outputs the number and takes in user's answer
            cout << number << endl;
            
            int temp;
            cin >> temp;
            
            // Correct Answer
            if(temp == randomNum){
                
                cout << endl;
            }
            
            // Wrong answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
            }
            
        }
        
        // Checks to see if random number is less than 40
        else if(randomNum < 40){
            
            // Creates loop to iterate as many times as 10 goes into the random number
            for(int rep = 0; rep < randomNum/10; rep++){
                
                // adds an X to the string for each iteration
                number += "X";
            }
            
            // If the number is 1 unit away from a base (aka 19, 29, 39)
            if(((randomNum + 1) % 10) == 0){
                number += "IX";
            }
            
            // If the number ends in a 5
            else if((randomNum % 5) == 0){
                number += "V";
            }
            
            // If the number ends in 6, 7, or 8
            else if(((randomNum % 5) < 4) && ((randomNum % 10) > 5)){
                number += "V";
                
                // A loop that iterates for each remaining value when random is divided by 5
                for(int rep = 0; rep < (randomNum % 5); rep++){
                    
                    // Appends an I for each iteration
                    number += "I";
                }
            }
            
            // If the number ends in a 4
            else if(((randomNum + 1) % 5) == 0){
                number += "IV";
                
            }
            
            // Oterwise, just adds Is for each unit random is above a base 10
            else {
                
              
                // Loop that iterates for each value that random number is above 10
                for(int rep = 0; rep < (randomNum % 10); rep++){
                    
                    // Appends an I to the string
                    number += "I";
                }
                
            }
            
            // Outputs numeral and takes user's input
            cout << number << endl;
            int temp;
            
            cin >> temp;
            
            
            // Correct Answer
            if(temp == randomNum){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
            }
            
        }
        
        // If random is greater than 40 & less than 50
        else if(randomNum >= 40 && randomNum < 50){
            
            // Creates 49 in numerals if number is 49.. How whack is it that that's 49..!
            if(randomNum == 49){
                
                 number += "XLIX";
            }
            
            // Creates 40 in numerals
            else{
                
                number += "XL";
                
                // Appends a V if the number requires
                if((randomNum - 40) >= 5){
                    number += "V";
                }
                
                // Adds Is for amount or remainder when divided by 5
                for(int rep = 0; rep < (randomNum % 5); rep++){
                    
                    number += "I";
                }
            }
            
            // Outputs numeral and recieves users input
            cout << number << endl;
            int temp;
            
            cin >> temp;
            
            // Correct Answer
            if(temp == randomNum){
                cout << endl;
            }
            
            // Wrong Answer
            else {
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;

                
            }
            
            
            
        }
        
        
        // Checks to see if random number is greater than 50
        else if(randomNum > 50 && randomNum < 90){
            
            number += "L";
            
            // Creates loop to iterate as many times as 10 goes into the random number
            for(int rep = 0; rep < randomNum/10; rep++){
                
                // adds an X to the string for each iteration
                number += "X";
            }
            
            // If the number is 1 unti away from a base (aka 19, 29, 39)
            if(((randomNum + 1) % 10) == 0){
                number += "IX";
            }
            
            // If the number ends in a 5
            else if((randomNum % 5) == 0){
                number += "V";
            }
            
            // If the number ends in 6, 7, or 8
            else if((randomNum % 5) < 4){
                number += "V";
                
                // A loop that iterates for each remaining value when random is divided by 5
                for(int rep = 0; rep < (randomNum % 5); rep++){
                    
                    // Appends an I for each iteration
                    number += "I";
                }
            }
            
            // If the number ends in a 4
            else if(((randomNum + 1) % 5) == 0){
                number += "IV";
                
            }
            
            // Otherwise, just adds Is for each unit random is above a base 10
            else {
                
                
                // Loop that iterates for each value that random number is above 10
                for(int rep = 0; rep < (randomNum % 10); rep++){
                    
                    // Appends an I to the string
                    number += "I";
                }
                
            }
            
            // Outputs numeral and takes user's input
            cout << number << endl;
            int temp;
            
            cin >> temp;
            
            
            // Correct Answer
            if(temp == randomNum){
                cout << endl;
            }
            
            // Wrong Answer
            else{
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
            }
            
        }
        
        
        // If number is between 90 and 100
        else{
            
           
            // Creates 99 in numerals if number is 99.. How whack is it that that's 99..!
            if(randomNum == 99){
                
                number += "XCIX";
            }
            
            // Creates 90 in numerals
            else{
                
                number += "XC";
                
                // Appends a V if the number requires
                if((randomNum - 90) >= 5){
                    number += "V";
                }
                
                // Adds Is for amount or remainder when divided by 5
                for(int rep = 0; rep < (randomNum % 5); rep++){
                    
                    number += "I";
                }
            }
            
            // Outputs numeral and recieves users input
            cout << number << endl;
            int temp;
            
            cin >> temp;
            
            // Correct Answer
            if(temp == randomNum){
                cout << endl;
            }
            
            // Wrong Answer
            else {
                
                lives --;
                cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
                
                //returns false
                return false;
                
                
            }
        

            
            
        }

        
    }
    
    
    
    return true;
}



/*
 
    Methods to give the game a little more personality

 */

// Correct answer messages
string correctAnswer(){
    
    // Gives rand() a new seed
    srand ( time(0) );

    // Generates random int using rand()
    int random = rand() % 26;
    
    cout << endl;
    
    if(random == 0){
        return "Sweet!! ";
    }
    
    if(random == 1){
        return "I ALWAYS BELIEVED IN YOU! ";
    }
    
    if(random == 2){
        return "Nice One! ";
    }
    
    if(random == 3){
        return "Smell that.? That's the smell of victory! HARRAH! ";
    }
    
    if(random == 4){
        return "VICTORY SCREECH! ";
    }
    
    if(random == 5){
        return "I'm so proud!! ";
    }
    
    if(random == 6){
        return "We... i mean YOU did it!";
    }
    
    if(random == 7){
        return "Wow... so many points alrady..! Wild stuff my guy!";
    }
    
    if(random == 8){
        return "You make me smile like the sun! ";
    }
    
    if(random == 9){
        return "happy 4 u!! ";
    }
    
    if(random == 10){
        return "Gee Willikers friend! You got that one very correct! ";
    }
    
    if(random == 11){
        return "HIGH FIVE FOR THE CORRECT ANSWER! ";
    }
    
    if(random == 12){
        return "Fastest answer this side of the Mississippi! Whichever end that may be! ";
    }
    
    if(random == 13){
        return "You're overqualified! ";
    }
    
    if(random == 14){
        return "And to believe I thought you were a chump.. Great job! ";
    }
    
    if(random == 15){
        return "HOW'D YOU DO THAT ONE?! ";
    }
    
    if(random == 16){
        return "Epic gamer win! (I had to include atleast 1 meme... probably long dead already) ";
    }
    
    if(random == 17){
        return "This ones for you! You can't see but I raised my glass to you! ";
    }
    
    if(random == 18){
        return "Simply.. amazing.. ";
    }
    
    if(random == 19){
        return "My mom saw you answer that one.. she says I should have more friends like you.. ";
    }
    
    if(random == 20){
        return "As they say in Swedish \"Nu är det kokta fläsket stekt\"! I urge you to google that! ";
    }
    
    if(random == 21){
        return "Keep giving it your all! ";
    }
    
    if(random == 22){
        return "Brilliantly executed! ";
    }
    
    if(random == 23){
        return "~~~~ FABULOUS ~~~~ ";
    }
    
    if(random == 24){
        return "Making your friends and family proud! ";
    }
    
    if(random == 25){
        return "To heck with all those teamwork proverbs, YOU ARE ALL YOU NEED! ";
    }
    
    else return "Well.... That shouldn't have happened... not you getting the question correct... the internal error..";
}


// Words of Disappointment
string incorrectAnswer(){
    
    // Gives rand() a new seed
    srand ( time(0) );

    // Creates random int using rand()
    int random = rand() % 16;
    
    
    if(random == 0){
        return "OUCH! I'm sorry, that's wrong... ";
    }
    
    if(random == 1){
        return "SO CLOSE.... just kidding I really don't know.. ";
    }
    
    if(random == 2){
        return "I believe in you! But maybe I shouldn't have that time... ";
    }
    
    if(random == 3){
        return "You wouldve done awesome on that one, if the task was to do terribly... ";
    }
    
    if(random == 4){
        return "Well... You tried! ";
    }
    
    if(random == 5){
        return "Nice one!! Just kidding, that's really wrong..";
    }
    
    if(random == 6){
        return "Have you not been paying attention..?";
    }
    
    if(random == 7){
        return "You're wronger than the word \"wronger\" sounds..";
    }
    
    if(random == 8){
        return "Don't you know how long it took me to make this game?? The least you can do is get the answers correct!";
    }
    
    if(random == 9){
        return "Close, but no cigar..";
    }
    
    if(random == 10){
        return "OOF... That one hurt me too :(";
    }
    
    if(random == 11){
        return "Remember Tom & Jerry..? You're really acting like Tom rightn now..";
    }
    
    if(random == 12){
        return "Sometimes... effort just isn't enough..";
    }
    
    if(random == 13){
        return "I wish I could help you... cause you really need it..";
    }
    
    if(random == 14){
        return "Randomly generated generic response to your ignorance #120321: \"You embarass me\"";
    }
    
    if(random == 15){
        return "Eat a can of spinnach.. or do something, just stop being wrong..";
    }


    
    else return "Well... That shouldn't have happened... but you're also incorrect.. ";
}



//Words of Wisdom
string wordsOfWisdom(){
  
   
    // Gives rand() a new seed
    srand ( time(0) );
    
    // Creates random int using rand() from <stdlib.h>
    int random = rand()%31;
    
    //Random responses
    if(random == 0){
        return "Never look back.. You dont have time for that!";
    }
    
    
     if(random == 1){
        return "Time is the one thing you can never get back... and you're wasting it!";
    }
    
    
     if(random == 2){
        return "Smile more... please!!";
    }
    
    
     if(random == 3){
        return "Don't overthink this..";
    }
    
    
     if(random == 4){
        return "Lightning strikes the earth about 100 times every second... That's like 300 times since you started reading this..!";
    }
    
    
     if(random == 5){
        return "Are you enjoying yourself?? Let me know! +1(805)231-1561";
    }
    
    
     if(random == 6){
        return "Try listening to faster paced music maybe.?";
    }
    
    
     if(random == 7){
        return "Open a window! Fresh air is good for you!";
    }
    
    
     if(random == 8){
        return "Carrot cake is perhaps one of the best collabs we've ever seen.. it evolved from carrot pudding! Sounds much less appetizing..";
    }
    
    
     if(random == 9){
        return "Cool game, huh?";
    }
    
    if(random == 10){
        return "Theres billions of people in this world... your small mistakes really don't matter much!";
    }
    
    if(random == 11){
        return "Can you do a cartwheel?? Show me!";
    }
    
    if(random == 12){
        return "Don't trip chocolate chip.";
    }
    
    if(random == 13){
        return "Simpossible because it's so simple... but still impossible... get it now?";
    }
    
    if(random == 14){
        return "I hope some of these little words of wisdom have made you smile!";
    }
    
    if(random == 15){
        return "You're wonderful!";
    }
    
    if(random == 16){
        return "That was so quick I didn't even see your fingers move!";
    }
    
    if(random == 18){
        return "Check out my mixtape: 11101101000110100";
    }
    
    if(random == 19){
        return "Lo Hicimos!";
    }
    
    if(random == 20){
        return "Don't copy and paste code kids! That's how bugs are spread!";
    }
    
    if(random == 21){
        return "Every correct answer is another byte of RAM I consume!";
    }
    
    if(random == 22){
        return "High levels of arousal are best for simple tasks, such as these! Check out Yerkes-Dodson Law!";
    }
    
    if(random == 23){
        return "They did surgery.. on a grape!!! (This meme is probably long dead..)";
    }
    
    if(random == 24){
        return "RIP all the hours you've spent on this game...";
    }
    
    if(random == 25){
        return "Kanpai!";
    }
    
    if(random == 26){
        return "Salud!";
    }
    
    if(random == 27){
        return "Cheers!";
    }
    
    if(random == 28){
        return "Skål!";
    }
    
    if(random == 29){
        return "Spread love and acceptance, and the world may become a better place yet!!";
    }
    
    if(random == 30){
        return "Read more Tolkien! (Not paid for by the Tolkien Trust).";
    }
    
    else return "Well... That shouldn't have happened!";
}

// Thanks for reading && playing!

/*
 
    if(gameEnjoyed(USER)) return aidantakami.com   ;
 
        // More games and FUN to be added soon! My website is the best way to stay connected!
 
 */

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s