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!
 
 */

Roman Numeral Generator

Hello all! So as you can read in some previous posts I have been working on a roman numeral ID method for my Simpossible game. The code is now finished! Previous posts were only inclusive up to the roman numeral for 20 but now it is complete, including numerals all the way up to 100! It took a while to perfect the method, but ALAS it is complete! I had lots of fun with this specific method as it posed some very interesting challenges utilizing the modulus operation. Ill paste the code and some output below! Enjoy!

    // 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;
}


Roman Numerals ID Method

Hello all! So I’ve been working more on my Simpossible game, and specifically on the roman numerals ID minigame I talked about in earlier posts. So, in short, I’ve been working with the modulus operator nonstop for a couple hours… But it’s been really fun! So far, it’s coming together well. The majority of my time I spent on devising just how I would turn regular numbers into roman numerals. I’ve done it mostly by using whats called the “modulus” operator (%). You can read more on that here, but I’ll explain the basis for anyone unfamiliar with programming basics. It’s an operator (Like plus, minus or multiply) which will return the remainder of the first number divided by the second. So, 17 % 5 = 2. This operator is used most frequently in creating bounds for the rand() function, or to find whether or not a number is even.

My use of this operator has been to find whether or not a roman numeral requires an “X” or a “V”. So, for example, I can use the equation 17%10 = 7, and from there determine the appropriate numeral is XVII.

Below is some output and the unfinished method. I hope you enjoy!

/*

    Roman Numeral ID

 */

bool romanNumerals(int difficulty){

    // Start of game

    // Initialize roman numeral string to be appended

    string number;

    cout &lt;&lt; "Hey, ID this Roman Numeral for me.?" &lt;&lt; endl;

    sleep(3);

    // Difficulties below or equal to 1
    if(difficulty &lt;= 1){

        // Seed &amp; initialize rand
        srand(time(0));
        int randomNum = rand()% 5;

        // Ensures rand cant = 0
        if (randomNum == 0) randomNum += 3;

        // If rand is &lt; 4, the numeral will only consist of "I"
        if(randomNum &lt; 4){

            // Create the roman numeral up to 3
            for(int rep = 0; rep &lt; randomNum; rep++){

                number += "I";
            }

            // Output numeral
            cout &lt;&lt; number &lt;&lt; endl;

            // Take user answer
            int temp;
            cin &gt;&gt; temp;

            // Correct Answer

            if (temp == randomNum){

                cout &lt;&lt; endl;
            }

            // Wrong Answer
            else {

                lives --;
                cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                //returns false
                return false;

            }

        }

        // If rand = 4
        else {

            // Outputs 4 in Roman Numerals
            cout &lt;&lt; "IV" &lt;&lt; endl;

            // Take user answer
            int temp;
            cin &gt;&gt; temp;

            // Correct Answer

            if(temp == 4){

                cout &lt;&lt; endl;
            }

            // Wrong Answer
            else{

                lives --;
                cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                //returns false
                return false;

            }
        }
    }

    // Difficulty &gt; 1 &amp;&amp; &lt; or equal to 5
    else if(difficulty &gt; 1 &amp;&amp; difficulty &lt;= 5){

        // seeds and initializes rand range 5 - 20
        srand(time(0));
        int randomNum = rand() % 20 + 6;

        // Rand = 5
        if(randomNum == 9){

            // Output
            cout &lt;&lt; "IX" &lt;&lt; endl;

            // User input
            int temp;
            cin &gt;&gt; temp;

            // Correct Answer

            if (temp == 9){

                cout &lt;&lt; endl;
            }

            // Wrong Answer
            else{

                lives --;
                cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                //returns false
                return false;

            }
        }

        // Rand = 14
        else if(randomNum == 14){

            // Output
            cout &lt;&lt; "XIV" &lt;&lt; endl;

            // User input
            int temp;
            cin &gt;&gt; temp;

            // Correct Answer

            if (temp == 14){

                cout &lt;&lt; endl;
            }

            // Wrong Answer
            else{

                lives --;
                cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                //returns false
                return false;

            }
        }

        // Rand = 15
        // IDK WHY but this wont work rn
        else if(randomNum == 15){

            // Output
            cout &lt;&lt; "XV" &lt;&lt; endl;

            // User input
            int temp;
            cin &gt;&gt; temp;

            // Correct Answer

            if (temp == 15){

                cout &lt;&lt; endl;
            }

            // Wrong Answer
            else{

                lives --;
                cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                //returns false
                return false;

            }
        }

        // Rand = 19
        else if(randomNum == 19){

            // Output
            cout &lt;&lt; "IXX" &lt;&lt; endl;

            // User input
            int temp;
            cin &gt;&gt; temp;

            // Correct Answer

            if (temp == 19){

                cout &lt;&lt; endl;
            }

            // Wrong Answer
            else{

                lives --;
                cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; 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 &lt; (randomNum/10); rep++){

                    number += "X";
                }

                // Output
                cout &lt;&lt; number &lt;&lt; endl;

                // User input
                int temp;
                cin &gt;&gt; temp;

                // Correct Answer

                if(temp == randomNum){

                    cout &lt;&lt; endl;
                }

                // Wrong Answer
                else{

                    lives --;
                    cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                    //returns false
                    return false;

                }
            }

            // If rand can be divided by 10 with a remainder less than 4
            else if((randomNum % 10) &lt; 4){

                //Starts numeral with a X
                number += "X";

                // Creates the random numeral
                for(int rep = 0; rep &lt; (randomNum - 10); rep++){

                    number += "I";
                }

                // Output
                cout &lt;&lt; number &lt;&lt; endl;

                // Input
                int temp;
                cin &gt;&gt; temp;

                // Correct Answer

                if (temp == randomNum){

                    cout &lt;&lt; endl;
                }

                // Wrong Answer
                else{

                    lives --;
                    cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                    //returns false
                    return false;

                }
            }

            // If rand can be divided by 10 with a remaineder greater than 5
            else if((randomNum % 10) &gt; 5){

                // Starts numeral with a XV

                number += "XV";

                // Creates random numeral

                for(int rep = 0; rep &lt; (randomNum - 15); rep++){

                    number += "I";
                }

                // Output
                cout &lt;&lt; number &lt;&lt; endl;

                // Input
                int temp;
                cin &gt;&gt; temp;

                // Correct Answer

                if(temp == randomNum){

                    cout &lt;&lt; endl;
                }

                // Wrong Answer
                else{

                    lives --;
                    cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                    //returns false
                    return false;

                }
            }

            // If rand is not divisible by 10 at all, aka less than 10
            else if(randomNum &gt; 5 &amp;&amp; randomNum &lt; 9){

                // Starts numeral with a V
                number += "V";

                // Creates the random numeral
                for(int rep = 0; rep &lt; (randomNum - 5); rep++){

                    number += "I";
                }

                // Output
                cout &lt;&lt; number &lt;&lt; endl;

                // Input
                int temp;
                cin &gt;&gt; temp;

                // Correct Answer

                if(temp == randomNum){

                    cout &lt;&lt; endl;
                }

                // Wrong Answer
                else{

                    lives --;
                    cout &lt;&lt; incorrectAnswer() &lt;&lt; " You have " &lt;&lt; lives &lt;&lt; " lives left! " &lt;&lt; endl &lt;&lt; endl;

                    //returns false
                    return false;

                }
            }

        }
    }

    return true;
}

Simpossible Personality

Hey all!

It’s my birthday! Therefore, I gave myself some time to work on my passion projects, such as this game, and even explore some old design documents which i’ll probably post about a little later today as well!

So a couple weeks ago I shared with you guys my game Simpossible in this post. Since the, I’ve been working pretty hard in school and all that, but I have had some time to work a little more on my game, and wanted to post to further include my audience on what makes this project really special to me!

The personality I’m trying to give this game is what I feel will make it more than just another text based game. I’m doing this in 2 main ways: Words of Wisdom and Words of Disappointment.

My Words of Wisdom are quirky little snippits that are included at the start of every new game, every upping in difficulty, and every correct answer, and  I hope to make them numerous enough that a player never sees the same one twice. They range from dumb little sayings and goofy interactions to actual advice and fun facts.

My Words of Disappointment are essentially the opposite. They’re dumb little snips of the “character” poking fun at, and antagonizing the player, in a very very softhearted fashion.

A great (and incredibly relevant) example of this approach being used is the new game Smash Brothers: Ultimate. In loading screens, tips, backgrounds, and simply entertaining text tidbits appear. They used the text to input personality into the game. My favorite example, pulling from my favorite game, is their background on Sheik. It goes something like: “Sheik is originally from The Legend of Zelda Ocarina of Time, released in 1996. Though her true identity is a mystery at the beginning, we soon found out that she was actually Ze- I won’t spoil it for you“. It’s small little insertions like that which give the game a personification, and that’s just one example of the many embedded within this game. It’s cool to see techniques that I believe very strongly in being used in such a successful franchise, such as Smash Bros.

You can see output of these lines in action on my earlier post about the game. It’s very simple, but effective and easy. I’ll probably end up adding an array of previously selected lines to ensure the diversity in the lines, and that the user doesn’t get the same one twice in a single game session, but for now I’ll share with you the code as it is:

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

    // 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 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(NULL) );
    
    // Creates random int using rand() from 
    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!";
}

Simpossible Initial Overview and Code

Hello there!

I haven’t been very active here these last few months, my apologies! I’ve been swamped with my classes. But all is well, classes are going really well for me, but the only downside is my free time to program and work on passion projects has been effectively consumed by the amount of work my classes have been requiring. However, as finals week approaches I have had a little more time to be working on a game which I started a few months back.

The game I’ve been working on I have titled Simpossible. It’s essentially a game of mini games, all done through text. It’s in C++, and is built entirely upon speed. The score increases with each quick minigame, and the faster a task is completed, the higher the score for that specific game. by quick, I mean very quick. The game will cut you off at 10 seconds, which is achievable at the start, but as difficulty of tasks increases, this time limit becomes a serious constraint.

A big thing I’ve been trying to do with this project is give the game a personality of it’s own. I’ll post more on that in the future, but as you look at output, take notice of the little, what I’ve called, words of wisdom and words of disappointment. So far, I’ve put in about 25 unique lines for both, but I would like to have it around 100 or so by the time I’ve finished the project, but as it’s extremely simple to add to, I just haven’t taken the time yet… IM BUSY!

So far, I’ve created only 4 minigames, but hope to come to about 10 by the time I am finished. Each round is comprised of 5 “events”, each one of them being a try at one of the minigames, randomly selected. The player has 3 lives, which are lost by incorrect answers. The punishment for not meeting the time constraint is no points for the event. The games so far include the following:

Math Game:

The simplest of the games to explain, the user is given a problem to solve and must answer the problem correctly. Starting with simple addition and eventually elevating to include all operations and order of operations. The challenge is I must keep it simple enough that most would be able to reasonably solve even the most difficult of these problems within 14 seconds at most. This is important because the game must remain competitive and fun even at the higher difficulties. I’ll post code at bottom, but heres some output:

Screen Shot 2018-11-29 at 3.36.51 PMScreen Shot 2018-11-29 at 3.35.32 PM

Repeat After Me:

This game just creates a random string of letters that the user must replicate within the time limit. The letters are truly random, so as of now they are absolute gibberish… I have considered pairing this program with a file of the english lexicon and possibly just pulling random words from there, but I think that would be too easy for the player, and there’s something I really find fun and interesting about the output of completely random strings. As difficulty increases, the string is lengthened to add more nonsense. Heres some output, I’ll include some code at the bottom:

Screen Shot 2018-11-29 at 3.37.35 PM

(looking at the output, it looks a little lame super fun! )

But I do promise it’s actually a lot of fun to play around with!

Let’s Dance:

Let’s dance is my favorite game I’ve implemented so far. It feeds you a series of directions and you have to respond to those directions one at a time, to replicate the idea of DDR. It’s actually a lot of fun. I had to resort to using the WASD keys as opposed to arrow keys, because I couldn’t find a way to make the arrows work for both MAC OS and Windows, but it doesn’t take away from the idea of things, or at least I don’t think. Here’s some output:

Screen Shot 2018-11-29 at 3.36.18 PM

Roman Numeral Game:

The last game that I’ve just started working on implementing is a roman numeral identification game. It’s going to feed the user randomly generated roman numerals, and the player must translate them into the numbers we know and love. While simple at first, the game is going to go on to involve numbers which not everybody may be able to decipher. I’m still working on this game, and trying to emphasize playability, because I know this one could be a little tougher for some.

Here’s some code:

/*
 
 
    Math Game
 
 
 */


//Math Game
bool mathGame(int difficulty){

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

    /*
     
        Difficulty 0 - 2
     
     */
    
    if(difficulty <= 2){
        
        
        //Generates vars & decides operation
        int var1 = (rand() % 11) * difficulty;
        int var2 = (rand() % 11) * difficulty;
        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 doability
            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 - 15            */               //Increase in difficulty     else if(difficulty > 10 && difficulty <= 15){
        
        
        //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 doability
            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
 
 */

//Repeat After Me Game
bool repeatAfterMe(int difficulty){
    
    //Basic instructions
    cout << "Repeat after me!! " << endl;
    sleep(2);
        
    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
    if(answer == sentence) return true;
    
    
    else{
        
        lives --;
        cout << incorrectAnswer() << " You have " << lives << " lives left! " << endl << endl;
        
        //returns false
        return false;
    }
}