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


 

3 thoughts on “Simpossible Initial Overview and Code

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