Unity Crash Destroys My Happiness

Well, shit… After spending a few days working on an order taking software based off of my job at In N Out, a Unity crash proved to be all it took for me to lose all progress. Since the software was only 1 scene, that scene has been completely wiped. Despite my good saving habits, and having exited out of Unity3D multiple times, and still having my project, this one crash seems to have completely wiped all my progress (except for my code). Everything carries a lesson and the lesson i’ve learned from this is after a Unity crash, to not re open Unity, but instead find out  of the automatic backups stored in the “temp” folder under assets. Save yourself time, & sanity, and learn from my mistakes.

 

All that aside, I still have some interesting code and was working with some interesting ways in which I could store & display an order in progress, as well as a completed order. Using a generic type “BurgerObject”, that take the specific type of burger as a string, and have the ingredients stored in a List, I am able to accurately recreate how order taking works across all In N Out store locations. In addition to this, using the buttons that I had placed across the scene to represent each item would add a new text to the screen, representing the burger/item added, adding it to the entirety of the order. I found it difficult to decide how I was going to best display the entire order, since the order is stored in a List and displaying a List seems to be pretty much undoable in C#, but found this way to be likely the most promising. Here’s some code (please know that this is not nearly completed, just posting what I had completed pre crash):

 

Screen Shot 2018-07-26 at 11.59.28 AMScreen Shot 2018-07-26 at 11.58.07 AMScreen Shot 2018-07-26 at 11.58.14 AM

Game Update: Tic Tac Toe

After finishing up my Tic Tac Toe AI, I was left wondering: “Is this bot really the best Tic Tac Toe competitor I can create?”, so I went to work towards another concept of AI to compete in my game versus the original bot. Below are details of the 2 bots, as well as a link to the .pdf showing the outcome of their 10,000 matchups.

 

CPU 1 is the original bot I created a few days back. The code can be accessed in the link above. This bot takes a unique approach every turn, excluding the final two turns. The first turn it will default to the middle box (spot 5), or, if that is occupied, the bottom right box (spot 9). From there it will place its next 2 pieces according to how it’s opponent is trying to play. If the opponent is aggressive in trying to get 3 in a row, it will play defensively. If the opponent is more lax in their approach, the bot will go for the win. The bot has every possible situation, and the appropriate response, hard coded into it’s programming for turns 2 & 3. Turns 4 & 5 the bot looks for any possible opportunity, by either player, to win the match, and places it’s piece in the spot that would complete the 3 in a row. If none can be found, it simply places in a random open space.

 

CPU 2 is the bot I created in an attempt to out play my previous bot. The bot’s moves are decided very basically on whether or not the bot has a chance to win. In a kind of “bogo sort” fashion, the bot will make it’s first move at complete random, since the first move is rather insignificant. From there it gauges the opponent’s move, decides whether or not the opponent has a chance to win (not by using specific spot numbers but instead the overall state of the board), and if so defends the move, and if not places it’s piece in the way it deems easiest to get a 3 in a row. This move is the repeated for the rest of the game.

 

Click here to view the stat sheet.

 

In conclusion, as of now the original AI is by far the superior, but it would be preferable to decrease the overall number of draws, and perhaps make the bot more aggressive, resulting in more wins.

Game Sample: Tic Tac Toe AI

Over the last few weeks I have been implementing a bot into my Tic Tac Toe program, allowing a single player to test their skills at tic tac toe, while also sharpening my skills in regards to writing AI. The bot has proven to be a somewhat tedious, but very successful attempt at Artificial Intelligence. After many hours of testing, and improvising (and nearly 2000 lines of code), I believe it to be unbeatable… while I’m sure there is a flaw in there somewhere, I am unable to find it. I will continue to improvise and improve the bot, but for the time being, it is completed! Here is some gameplay (Just a note: the bot always plays as player 2 (O)):

Screen Shot 2018-04-04 at 1.46.34 AMScreen Shot 2018-04-04 at 1.46.59 AMScreen Shot 2018-04-04 at 1.47.26 AM

//
//  main.cpp
//  Tic Tac Toe
//
//  Created by Aidan Takami on 3/8/18.
//  Copyright © 2018 Aidan Takami. All rights reserved.
//

#include 
#include 

using namespace std;

//Array to represent the spots on the board
char spot[10] = {'o','1','2','3','4','5','6','7','8','9'};
char cpuChoices[5]{0,0,0,0,0};

int ifWon();
void singlePlayer();
void cpuTurn(int);
void board();
void clearBoard();
void clearCpu();
bool cpuChoicesContains(char);
int findSpot();

//Main method
int main()
{
    
    cout << "\n\n\tTic Tac Toe\n\n";
    
    
    //Allows player to play vs CPU or human
    
    string temp;
    cout << "Would you like to play with 2 players, or 1? (enter 1 or 2)" << endl;     cin >> temp;
    
    if(temp == "1"){
        singlePlayer();
    }

start:

    int player = 1,i = -1,choice;

    char side, playOn;
    
    //Game loop, which will continue while no player has won
    while(i==-1){
        
        //Draws the board
        board();
        
        //Deciphers which players turn it is, using the modulus operator
        player=(player%2)?1:2;
        
        //Intro text & takes players move
        cout << "Player " << player << ", enter a number:  ";         cin >> choice;
        
        //Decides the team that the current player is on (X's or O's)
        side=(player == 1) ? 'X' : 'O';
        
        
        //Will take the player's move and mark the correct box (if unoccupied) with the correct side
        if (choice == 1 && spot[1] == '1')
            
            spot[1] = side;
        else if (choice == 2 && spot[2] == '2')
            
            spot[2] = side;
        else if (choice == 3 && spot[3] == '3')
            
            spot[3] = side;
        else if (choice == 4 && spot[4] == '4')
            
            spot[4] = side;
        else if (choice == 5 && spot[5] == '5')
            
            spot[5] = side;
        else if (choice == 6 && spot[6] == '6')
            
            spot[6] = side;
        else if (choice == 7 && spot[7] == '7')
            
            spot[7] = side;
        else if (choice == 8 && spot[8] == '8')
            
            spot[8] = side;
        else if (choice == 9 && spot[9] == '9')
            
            spot[9] = side;
        
        //If selected box is occupied
        else
        {
            cout<<"Invalid move ";
            
            //gives the same player another turn
            player--;
            cin.ignore();
            cin.get();
        }
        
        //determines if the board contains a win or draw.
        i=ifWon();
        
        //Continues the play process
        player++;
    }
    
    //If a player won, draws the board and announces who won
    board();
    if(i==1)
        
        cout<<"Player "<<--player<<" wins! ";
    
    //If draw, announces a draw
    else
        cout<<"==>\aGame draw";
    
    
    //Gives players an option to play again
    cout << " Would you like to play again? (y/n)" << endl;     cin >> playOn;
    
    if(playOn == 'y' || playOn == 'Y' ){
        clearBoard();
        goto start;
    }
    
    else
    exit(0);
}

//function that returns the result of the game

int ifWon()
{
   
    //Game was won
    if (spot[1] == spot[2] && spot[2] == spot[3])
        return 1;
    else if (spot[4] == spot[5] && spot[5] == spot[6])
        
        return 1;
    else if (spot[7] == spot[8] && spot[8] == spot[9])
        
        return 1;
    else if (spot[1] == spot[4] && spot[4] == spot[7])
        
        return 1;
    else if (spot[2] == spot[5] && spot[5] == spot[8])
        
        return 1;
    else if (spot[3] == spot[6] && spot[6] == spot[9])
        
        return 1;
    else if (spot[1] == spot[5] && spot[5] == spot[9])
        
        return 1;
    else if (spot[3] == spot[5] && spot[5] == spot[7])
        
        return 1;
    
    
    //Game was a draw
    else if (spot[1] != '1' && spot[2] != '2' && spot[3] != '3'
             && spot[4] != '4' && spot[5] != '5' && spot[6] != '6'
             && spot[7] != '7' && spot[8] != '8' && spot[9] != '9')
        
        return 0;
    
    
    //Game still in progress
    else
        return -1;
}



//Function that draws the board
void board()
{
 
    cout << endl << endl << endl;
    
    //Prints each box of the board with the contents of the array properly alligned
    cout << "Player 1 (X)  -  Player 2 (O)" << endl << endl << endl;
    cout << "     |     |     " << endl;
    cout << "  " << spot[1] << "  |  " << spot[2] << "  |  " << spot[3] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << spot[4] << "  |  " << spot[5] << "  |  " << spot[6] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << spot[7] << "  |  " << spot[8] << "  |  " << spot[9] << endl;
    cout << "     |     |     " << endl << endl;
}



//Method to allow player to play versus a CPU
void singlePlayer(){
    
start:
    
    int player = 1,i = -1,choice, round = 0;
    
    char side, playOn;
    
    //Game loop, which will continue while no player has won
    while(i==-1){
        
        //Deciphers which players turn it is, using the modulus operator
        player=(player%2)?1:2;
        
        //Draws the board for user
        if(player == 1)
            board();
        
        //Intro text & takes players move
        cout << "Player " << player << ", enter a number:  ";
        
        if(player == 2){
            cpuTurn(round);
            cout << "CPU turn!" << endl;         }         else{                      cin >> choice;
        
            //Decides the team that the current player is on (X's or O's)
            side=(player == 1) ? 'X' : 'O';
        
        
            //Will take the player's move and mark the correct box (if unoccupied) with the correct side
            if (choice == 1 && spot[1] == '1')
                spot[1] = side;
            
            else if (choice == 2 && spot[2] == '2')
            
                spot[2] = side;
            else if (choice == 3 && spot[3] == '3')
            
                spot[3] = side;
            else if (choice == 4 && spot[4] == '4')
            
                spot[4] = side;
            else if (choice == 5 && spot[5] == '5')
            
                spot[5] = side;
            else if (choice == 6 && spot[6] == '6')
            
                spot[6] = side;
            else if (choice == 7 && spot[7] == '7')
            
                spot[7] = side;
            else if (choice == 8 && spot[8] == '8')
            
                spot[8] = side;
            else if (choice == 9 && spot[9] == '9')
            
                spot[9] = side;
        
            //If selected box is occupied
            else
            {
                cout<<"Invalid move ";
            
                //gives the same player another turn
                player--;
                cin.ignore();
                cin.get();
            }
        }
        
        //determines if the board contains a win or draw.
        i=ifWon();
        
        //Continues the play process
        player++;
        round++;
    }
    
    //If a player won, draws the board and announces who won
    board();
    if(i==1)
        
        cout<<"Player "<<--player<<" wins! ";
    
    //If draw, announces a draw
    else
        cout<<"==>\aGame draw";
    
    
    //Gives players an option to play again
    cout << " Would you like to play again? (y/n)" << endl;     cin >> playOn;
    
    if(playOn == 'y' || playOn == 'Y' ){
        clearBoard();
        clearCpu();
        goto start;
    }
    
    else
        exit(0);

}


//AI to play against the player in single player mode
//Organized by turn.
void cpuTurn(int round){
    
    //in the first round
    if(round == 1){
      
        //AI will try to get the middle of the board
        if(spot[1] == 'X' || spot[2] == 'X' || spot[3] == 'X' || spot[4] == 'X'){
            spot[5] = 'O';
            cpuChoices[0] = '5';
        }
        
        else if(spot [6] == 'X' || spot [7] == 'X' || spot[8] == 'X' || spot[9] =='X'){
            spot[5] = 'O';
            cpuChoices[0] = '5';
        }
        
        //Otherwise, AI will go for spot 9
        else{
            spot[9] ='O';
            cpuChoices[0] = '9';
        }
    }
    
    
    //Second turn
    if(round == 3){
        
        
        //AI will decide based upon previous moves by both AI and user
        if(spot[1] == 'X' && spot[2] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[3] = 'O';
                cpuChoices[1] = '3';
            }
        }
        
        else if(spot[1] == 'X' && spot[3] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[2] = 'O';
                cpuChoices[1] = '2';
            }
        }
        
        else if(spot[1] == 'X' && spot[4] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[7] = 'O';
                cpuChoices[1] = '7';
            }
        }
        
        else if (spot[1] == 'X' && spot[5] == 'X'){
            spot[3] = 'O';
            cpuChoices[1] = '3';
        }
        
        else if(spot[1] == 'X' && spot[6] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[2] = 'O';
                cpuChoices[1] = '2';
            }
        }
        
        else if(spot[1] == 'X' && spot[7] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[4] = 'O';
                cpuChoices[1] = '4';
            }
        }
        
        else if(spot[1] == 'X' && spot[8] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[3] = 'O';
                cpuChoices[1] = '3';
            }
        }
        
        else if(spot[1] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[2] = 'O';
                cpuChoices[1] = '2';
            }
        }
        
        
        
        else if(spot[2] == 'X' && spot[3] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[2] == 'X' && spot[4] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[2] == 'X' && spot[5] == 'X'){
                spot[8] = 'O';
                cpuChoices[1] = '8';
        }
        
        else if(spot[2] == 'X' && spot[6] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[2] == 'X' && spot[7] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }

        else if(spot[2] == 'X' && spot[8] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[2] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[3] = 'O';
                cpuChoices[1] = '3';
            }
        }
        
        
        
        else if(spot[3] == 'X' && spot[4] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[3] == 'X' && spot[5] == 'X'){
                spot[7] = 'O';
                cpuChoices[1] = '7';
        }
        
        else if(spot[3] == 'X' && spot[6] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }
        
        else if(spot[3] == 'X' && spot[7] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[3] == 'X' && spot[8] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }
        
        else if(spot[3] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[6] = 'O';
                cpuChoices[1] = '6';
            }
        }
        
        
        
        else if(spot[4] == 'X' && spot[5] == 'X'){
                spot[6] = 'O';
                cpuChoices[1] = '6';
        }
        
        else if(spot[4] == 'X' && spot[6] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }
        
        else if(spot[4] == 'X' && spot[7] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[1] = 'O';
                cpuChoices[1] = '1';
            }
        }
        
        else if(spot[4] == 'X' && spot[8] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }
        
        else if(spot[4] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[3] = 'O';
                cpuChoices[1] = '3';
            }
        }

        
        
        else if(spot[5] == 'X' && spot[6] == 'X'){
                spot[4] = 'O';
                cpuChoices[1] = '4';
        }
        
        else if(spot[5] == 'X' && spot[7] == 'X'){
            spot[3] = 'O';
            cpuChoices[1] = '3';
        }
        
        else if(spot[5] == 'X' && spot[8] == 'X'){
            spot[2] = 'O';
            cpuChoices[1] = '2';
        }
        

        
        else if(spot[6] == 'X' && spot[7] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }

        else if(spot[6] == 'X' && spot[8] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }

        else if(spot[6] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[3] = 'O';
                cpuChoices[1] = '3';
            }
        }
        
        
        
        else if(spot[7] == 'X' && spot[8] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[9] = 'O';
                cpuChoices[1] = '9';
            }
        }
        
        else if(spot[7] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[8] = 'O';
                cpuChoices[1] = '8';
            }
        }
        
        else if(spot[8] == 'X' && spot[9] == 'X'){
            if(cpuChoices[0] == '5'){
                spot[7] = 'O';
                cpuChoices[1] = '7';
            }
        }

    }
    
    
    
    //third turn
    //Most complex turn, most games are won or lost in this round
    if(round == 5){
        
        //Spots 1 & 2 taken first
        
        if(spot[1] == 'X' && spot[2] =='X'){
            
            
            if(spot[4] =='X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('5')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }

            }
            
            else if(spot[5] == 'X'){
                if(cpuChoicesContains('9') && cpuChoicesContains('6')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('3')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
            }

            
            else if(spot[6] == 'X'){
                if(cpuChoicesContains('3')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('4')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else{
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
                
                
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('3')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('3')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
            }



            
        }
        
        
        //Spots 1 & 3 taken first
        
        
        else if(spot[1] == 'X' && spot[3] =='X'){
            
            if(spot[4] =='X'){
                if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(!cpuChoicesContains('7')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7') && cpuChoicesContains('5')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
            }
            
            else if(spot[5] == 'X'){
                if(!cpuChoicesContains('9')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(!cpuChoicesContains('7')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else{
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
            }

            
            else if(spot[6] == 'X'){
                if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('8') && cpuChoicesContains('5')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
                else if (!cpuChoicesContains('9')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if (cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('8') && cpuChoicesContains('5')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
                else{
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('3')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }

            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('8') && cpuChoicesContains('5')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
            }
            
            
        }
        
        //Spots 1 & 4 taken first
       else if(spot[1] == 'X' && spot[4] == 'X'){
            
             if(spot[5] == 'X'){
                if(!cpuChoicesContains('6')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('6')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
             }
            
             else if(spot[6] == 'X'){
                 if(cpuChoicesContains('7') && cpuChoicesContains('5')){
                     spot[3] = 'O';
                     cpuChoices[2] = '3';
                 }
                 
                 else if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                     spot[8] = 'O';
                     cpuChoices[2] = '8';
                 }
             }
            
             else if(spot[8] == 'X'){
                 if(cpuChoicesContains('3') && cpuChoicesContains('5')){
                     spot[7] = 'O';
                     cpuChoices[2] = '7';
                 }
                 
                 else if(cpuChoicesContains('7') && cpuChoicesContains('5')){
                     spot[3] = 'O';
                     cpuChoices[2] = '3';
                 }
                 
                 else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                     spot[7] = 'O';
                     cpuChoices[2] = '7';
                 }
             }
            
             else if(spot[9] == 'X'){
                 if(cpuChoicesContains('7') && cpuChoicesContains('5')){
                     spot[3] = 'O';
                     cpuChoices[2] = '3';
                 }
                 
                 else if(cpuChoicesContains('2') && cpuChoicesContains('5')){
                     spot[8] = 'O';
                     cpuChoices[2] = '8';
                 }
                 
                 else if (cpuChoicesContains('3') && cpuChoicesContains('5')){
                     spot[7] = 'O';
                     cpuChoices[2] = '7';
                 }
             }

        }
        
        //Spots 1 & 5 taken first
        
       else if(spot[1] == 'X' && spot[5] == 'X'){
            
            if(spot[6] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('4')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('2') && cpuChoicesContains('9')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
            
            
        }
        
        
        //Spots 1 & 6 taken first
        
       else if(spot[1] == 'X' && spot[6] == 'X'){
            
            if(spot[7] == 'X'){
                if(cpuChoicesContains('5') && cpuChoicesContains('2')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('3')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('4') && cpuChoicesContains('5')){
                    spot[6] = 'O';
                    cpuChoices[2] = 6;
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('5') && cpuChoicesContains('2')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
            
            else if(spot[9] == 'X'){
                if(!cpuChoicesContains('3')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
            
        }
            
            //Spots 1 & 7 taken first
            
           else if(spot[1] == 'X' && spot[7] == 'X'){
                
                if(spot[8] == 'X'){
                    if(cpuChoicesContains('5') && cpuChoicesContains('4')){
                        spot[6] = 'O';
                        cpuChoices[2] = '6';
                    }
                    
                    else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                        spot[6] = 'O';
                        cpuChoices[2] = '6';
                    }
                }
                
                else if(spot[9] == 'X'){
                    if(cpuChoicesContains('5') && cpuChoicesContains('4')){
                        spot[3] = 'O';
                        cpuChoices[2] = '3';
                    }
                    
                    else if(cpuChoicesContains('8') && cpuChoicesContains('5')){
                        spot[2] = 'O';
                        cpuChoices[2] = '2';
                    }
                }
        }
        
        //Spots 1 & 8 taken first
        
        else if(spot[1] == 'X' && spot[8] == 'X'){
            
            if(spot[9] == 'X'){
                if(!cpuChoicesContains('7')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7') && cpuChoicesContains('5')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
        }
        
        //Spots 2 & 3 taken first
        else if(spot[2] == 'X' && spot[3] == 'X'){
            
            if(spot[4] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
            }
            
            else if(spot[5] == 'X'){
                if(cpuChoicesContains('7') && cpuChoicesContains('9')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('8')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
            }
            
            else if(spot[6] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('6')){
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
            }
        }
        
        //Spots 2 & 4 taken first
        
       else if(spot[2] == 'X' && spot[4] == 'X'){
            
            if(spot[5] == 'X'){
                if(cpuChoicesContains('8') && cpuChoicesContains('9')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('6')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
            
            else if(spot[6] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = 1;
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = '7';
                    cpuChoices[2] = '7';
                }
            }
        }
        
        //Spots 2 & 5 taken first
        
        else if(spot[2] == 'X' && spot[5] == 'X'){
            
            if(spot[6] == 'X'){
                if(cpuChoicesContains('8') && cpuChoicesContains('9')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('4') && cpuChoicesContains('9')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('9') && cpuChoicesContains('8')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('3')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
            }
        }
        
        //Spots 2 & 6 taken first
        
        else if(spot[2] == 'X' && spot[6] == 'X'){
            
            if(spot[7] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
                
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
        }
        
        //Spots 2 & 7 taken first
        
       else if(spot[2] == 'X' && spot[7] == 'X'){
            
            if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('8') && cpuChoicesContains('5')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
            }
        }
        
        //Spots 2 & 8 taken first
        
        if(spot[2] == 'X' && spot[8] == 'X'){
            
            if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('3')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
            }
        }

        //Spots 3 & 4 taken first
        
        else if(spot[3] == 'X' && spot[4] == 'X'){
            
            if(spot[5] == 'X'){
                if(cpuChoicesContains('9') && cpuChoicesContains('6')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('7') && cpuChoicesContains('9')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
            }
            
            else if(spot[6] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
                
            }
            
            else if(spot[7] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
            }
            
            else if (spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if (cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if (spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('6')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
            }
        }
        
        //Spots 3 & 5 taken first
        
       else if(spot[3] == 'X' && spot[5] == 'X'){
            
            if(spot[6] == 'X'){
                if(cpuChoicesContains('7') && cpuChoicesContains('9')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('4') && cpuChoicesContains('9')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('9') && cpuChoicesContains('7')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('2')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
            }
        }
        
        //Spots 3 & 6 taken first
        
        else if(spot[3] == 'X' && spot[6] == 'X'){
            
            if(spot[7] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
                
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
        }


        //Spots 3 & 7 taken first
        
        else if(spot[3] == 'X' && spot[7] == 'X'){
            
            if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
            }
        }


        //Spots 3 & 8 taken first
        
        else if(spot[3] == 'X' && spot[8] == 'X'){
            
            if(spot[9] == 'X'){
                if(cpuChoicesContains('5') && cpuChoicesContains('6')){
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('7')){
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
            }
        }


        //Spots 4 & 5 taken first
        
        else if(spot[4] == 'X' && spot[5] == 'X'){
            
            if(spot[7] == 'X'){
                if(cpuChoicesContains('9') && cpuChoicesContains('6')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
                else if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('2') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('6')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
            }
        }
        
        //Spots 4 & 6 taken first
        
        else if(spot[4] == 'X' && spot[6] == 'X'){
            
            if(spot[7] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
                
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('5')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('1')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
        }
        
        //Spots 4 & 7 taken first
        
        else if(spot[4] == 'X' && spot[7] == 'X'){
            
            if(spot[8] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[9] = 'O';
                    cpuChoices[2] = '9';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('7')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
            }
        }


        //Spots 4 & 8 taken first
        
        else if(spot[4] == 'X' && spot[8] == 'X'){
            
            if(spot[9] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('5')){
                    spot[7] = 'O';
                    cpuChoices[2] = '7';
                }
            }
        }
        
        //Spots 5 & 6 taken first
        
        if(spot[5] == 'X' && spot[6] == 'X'){
            
            if(spot[7] == 'X'){
                if(cpuChoicesContains('4') && cpuChoicesContains('9')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
                
                else if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
            }
            
            else if(spot[8] == 'X'){
                if(cpuChoicesContains('4') && cpuChoicesContains('9')){
                    spot[2] = 'O';
                    cpuChoices[2] = '2';
                }
                
                else if(cpuChoicesContains('9') && cpuChoicesContains('5')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
                
                else if(cpuChoicesContains('2') && cpuChoicesContains('9')){
                    spot[4] = 'O';
                    cpuChoices[2] = '4';
                }
                
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('1') && cpuChoicesContains('5')){
                    spot[3] = 'O';
                    cpuChoices[2] = '3';
                }
            }
        }
        
        //Spots 5 & 7 taken first
        
        if(spot[5] == 'X' && spot[7] == 'X'){
            
            if(spot[8] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('9')){
                    spot[6] = 'O';
                    cpuChoices[2] = '6';
                }
                
            }
        }
        
        //Spots 6 & 7 taken first

        if(spot[6] == 'X' && spot[7] == 'X'){
            
            if(spot[8] == 'X'){
                if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
            }
            
            else if(spot[9] == 'X'){
                if(cpuChoicesContains('3') && cpuChoicesContains('5')){
                    spot[8] = 'O';
                    cpuChoices[2] = '8';
                }
                
                else if(cpuChoicesContains('5') && cpuChoicesContains('9')){
                    spot[1] = 'O';
                    cpuChoices[2] = '1';
                }
                
            }
        }
    }
    
    //Fourth turn
    //AI will search for any possible 3 in a row by both bot & human, and complete that row
    if(round == 7){
        if((spot[1] == spot[2]) && spot[3] == '3'){
            spot[3] = 'O';
        }
        
        else if((spot[4] == spot[5]) && spot[6] == '6'){
            spot[6] = 'O';
        }
        
        else if((spot[7] == spot[8]) && spot[9] == '9'){
            spot[9] = 'O';
        }
        
        else if((spot[2] == spot[3]) && spot[1] == '1'){
            spot[1] = 'O';
        }
        
        else if((spot[5] == spot[6]) && spot[4] == '4'){
            spot[4] = 'O';
        }
        
        else if((spot[8] == spot[9]) && spot[7] == '7'){
            spot[7] = 'O';
        }
        
        else if((spot[1] == spot[3]) && spot[2] == '2'){
            spot[2] = 'O';
        }
        
        else if((spot[4] == spot[6]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[7] == spot[9]) && spot[8] == '8'){
            spot[8] = 'O';
        }
        
        else if((spot[1] == spot[4]) && spot[7] == '7'){
            spot[7] = 'O';
        }
        
        else if((spot[2] == spot[5]) && spot[8] == '8'){
            spot[8] = 'O';
        }
        
        else if((spot[3] == spot[6]) && spot[9] == '9'){
            spot[9] = 'O';
        }
        
        else if((spot[1] == spot[7]) && spot[4] == '4'){
            spot[4] = 'O';
        }
        
        else if((spot[2] == spot[8]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[3] == spot[9]) && spot[6] == '6'){
            spot[6] = 'O';
        }
        
        else if((spot[4] == spot[7]) && spot[1] == '1'){
            spot[1] = 'O';
        }
        
        else if((spot[5] == spot[8]) && spot[2] == '2'){
            spot[2] = 'O';
        }
        
        else if((spot[6] == spot[9]) && spot[3] == '3'){
            spot[3] = 'O';
        }
        
        else if((spot[1] == spot[5]) && spot[9] == '9'){
            spot[9] = 'O';
        }
        
        else if((spot[3] == spot[5]) && spot[7] == '7'){
            spot[7] = 'O';
        }
        
        else if((spot[1] == spot[9]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[3] == spot[7]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[5] == spot[9]) && spot[1] == '1'){
            spot[1] = 'O';
        }
        
        else if((spot[5] == spot[7]) && spot[3] == '3'){
            spot[3] = 'O';
        }
        
        //If no win is possible, AI will place marker in arbitrary posistion
        else{
            spot[findSpot()] = 'O';
        }
    }
    
    
    //Fifth turn
    //Exact same as 4th turn
    if(round == 9){
        if((spot[1] == spot[2]) && spot[3] == '3'){
            spot[3] = 'O';
        }
        
        else if((spot[4] == spot[5]) && spot[6] == '6'){
            spot[6] = 'O';
        }
        
        else if((spot[7] == spot[8]) && spot[9] == '9'){
            spot[9] = 'O';
        }
        
        else if((spot[2] == spot[3]) && spot[1] == '1'){
            spot[1] = 'O';
        }
        
        else if((spot[5] == spot[6]) && spot[4] == '4'){
            spot[4] = 'O';
        }
        
        else if((spot[8] == spot[9]) && spot[7] == '7'){
            spot[7] = 'O';
        }
        
        else if((spot[1] == spot[3]) && spot[2] == '2'){
            spot[2] = 'O';
        }
        
        else if((spot[4] == spot[6]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[7] == spot[9]) && spot[8] == '8'){
            spot[8] = 'O';
        }
        
        else if((spot[1] == spot[4]) && spot[7] == '7'){
            spot[7] = 'O';
        }
        
        else if((spot[2] == spot[5]) && spot[8] == '8'){
            spot[8] = 'O';
        }
        
        else if((spot[3] == spot[6]) && spot[9] == '9'){
            spot[9] = 'O';
        }
        
        else if((spot[1] == spot[7]) && spot[4] == '4'){
            spot[4] = 'O';
        }
        
        else if((spot[2] == spot[8]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[3] == spot[9]) && spot[6] == '6'){
            spot[6] = 'O';
        }
        
        else if((spot[4] == spot[7]) && spot[1] == '1'){
            spot[1] = 'O';
        }
        
        else if((spot[5] == spot[8]) && spot[2] == '2'){
            spot[2] = 'O';
        }
        
        else if((spot[6] == spot[9]) && spot[3] == '3'){
            spot[3] = 'O';
        }
        
        else if((spot[1] == spot[5]) && spot[9] == '9'){
            spot[9] = 'O';
        }
        
        else if((spot[3] == spot[5]) && spot[7] == '7'){
            spot[7] = 'O';
        }
        
        else if((spot[1] == spot[9]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[3] == spot[7]) && spot[5] == '5'){
            spot[5] = 'O';
        }
        
        else if((spot[5] == spot[9]) && spot[1] == '1'){
            spot[1] = 'O';
        }
        
        else if((spot[5] == spot[7]) && spot[3] == '3'){
            spot[3] = 'O';
        }
        
        
        //If no win possible, AI will place marker in arbitrary posistion
        else{
            spot[findSpot()] = 'O';
        }
    }

}


//Method to clear the board & reset all values
void clearBoard(){

    spot[1] = '1';
    spot[2] = '2';
    spot[3] = '3';
    spot[4] = '4';
    spot[5] = '5';
    spot[6] = '6';
    spot[7] = '7';
    spot[8] = '8';
    spot[9] = '9';

}

//Clears Array of CPU choices
void clearCpu(){
    cpuChoices[0] = '0';
    cpuChoices[1] = '0';
    cpuChoices[2] = '0';
    cpuChoices[3] = '0';
    cpuChoices[4] = '0';
}


//Searches array of previous bot choices and returns true if bot has used that space
bool cpuChoicesContains(char value){
    for(int rep = 0; rep < 5; rep++){
        if(cpuChoices[rep] == value)
            return true;
    }
    
    return false;
}


//Will find a spot for bot to place piece, for likely game will result in draw
int findSpot(){
    
    if(spot[1] == '1') return 1;
    if(spot[2] == '2') return 2;
    if(spot[3] == '3') return 3;
    if(spot[4] == '4') return 4;
    if(spot[5] == '5') return 5;
    if(spot[6] == '6') return 6;
    if(spot[7] == '7') return 7;
    if(spot[8] == '8') return 8;
    if(spot[9] == '9') return 9;

    return 0;
}

 

Game Update: Tic Tac Toe AI

So over the past few weeks I have been working with Tic Tac Toe AI in an attempt integrate a bot into my Tic Tac Toe program, making it playable by just 1 person. The bot is coming along well, but through this process I have been reminded of the arduousness of creating AI. While the process has been incredibly fun, programming a bot to respond educatedly to every possible move made by a human is no small task. In addition to that, the bot must also take into account it’s own previous moves in order to construct the best, most likely to be successful, strategy.

To conquer this task I have been mapping every possible state of the tic tac toe board at every point of the game, taking into account the preset moves of the AI as well as every move that may be made by the human player. The mapping looks like this:IMG_1001

 

Using these notes I’m able to quickly assess which moves the bot should have programmed into itself, as well as which moves would never be necessary. For example, the bot will always try to go for the middle box (box 5) for it’s first move, but if that box is taken, it will default to the bottom right corner (box 9). Therefore, the bot will never encounter a situation in which the human player has both box 5 & box 9, so it does not need to have a response to that situation. While that is a very simple example, as the game progresses and the board becomes more complex, the number of situations which the bot could never face multiplies rapidly. Keeping track of these situations is crucial to creating clean, well organized code, as well as keeping the bot as efficient as possible. Below is some output from the unfinished bot. The bot should be finished and posted by early next week!Screen Shot 2018-03-29 at 2.49.41 PM

Game Sample: Tic Tac Toe

Below is my attempt at a 2 player Tic Tac Toe game. It’s fairly simple, but very neatly done. I’m currently working on an AI to incorporate into the program as an option for single players. I will be sure to post when finished! Heres some output:

Screen Shot 2018-03-09 at 10.50.16 AM Screen Shot 2018-03-09 at 10.50.49 AM

//
//  main.cpp
//  Tic Tac Toe
//
//  Created by Aidan Takami on 3/8/18.
//  Copyright © 2018 Aidan Takami. All rights reserved.
//

#include 
using namespace std;

//Array to represent the spots on the board
char spot[10] = {'o','1','2','3','4','5','6','7','8','9'};


int ifWon();
void board();
void clearBoard();

//Main method
int main()
{
    
        cout << "\n\n\tTic Tac Toe\n\n";
start:

    int player = 1,i = -1,choice;

    char side, playOn;
    
    //Game loop, which will continue while no player has won
    while(i==-1){
        
        //Draws the board
        board();
        
        //Deciphers which players turn it is, using the modulus operator
        player=(player%2)?1:2;
        
        //Intro text & takes players move
        cout << "Player " << player << ", enter a number:  ";         cin >> choice;
        
        //Decides the team that the current player is on (X's or O's)
        side=(player == 1) ? 'X' : 'O';
        
        
        //Will take the player's move and mark the correct box (if unoccupied) with the correct side
        if (choice == 1 && spot[1] == '1')
            
            spot[1] = side;
        else if (choice == 2 && spot[2] == '2')
            
            spot[2] = side;
        else if (choice == 3 && spot[3] == '3')
            
            spot[3] = side;
        else if (choice == 4 && spot[4] == '4')
            
            spot[4] = side;
        else if (choice == 5 && spot[5] == '5')
            
            spot[5] = side;
        else if (choice == 6 && spot[6] == '6')
            
            spot[6] = side;
        else if (choice == 7 && spot[7] == '7')
            
            spot[7] = side;
        else if (choice == 8 && spot[8] == '8')
            
            spot[8] = side;
        else if (choice == 9 && spot[9] == '9')
            
            spot[9] = side;
        
        //If selected box is occupied
        else
        {
            cout<<"Invalid move ";
            
            //gives the same player another turn
            player--;
            cin.ignore();
            cin.get();
        }
        
        //determines if the board contains a win or draw.
        i=ifWon();
        
        //Continues the play process
        player++;
    }
    
    //If a player won, draws the board and announces who won
    board();
    if(i==1)
        
        cout<<"Player "<<--player<<" wins! ";
    
    //If draw, announces a draw
    else
        cout<<"==>\aGame draw";
    
    
    //Gives players an option to play again
    cout << "Would you like to play again? (y/n)" << endl;     cin >> playOn;
    
    if(playOn == 'y' || playOn == 'Y' ){
        clearBoard();
        goto start;
    }
    
    else
    return 0;
}

//function that returns the result of the game

int ifWon()
{
   
    //Game was won
    if (spot[1] == spot[2] && spot[2] == spot[3])
        return 1;
    else if (spot[4] == spot[5] && spot[5] == spot[6])
        
        return 1;
    else if (spot[7] == spot[8] && spot[8] == spot[9])
        
        return 1;
    else if (spot[1] == spot[4] && spot[4] == spot[7])
        
        return 1;
    else if (spot[2] == spot[5] && spot[5] == spot[8])
        
        return 1;
    else if (spot[3] == spot[6] && spot[6] == spot[9])
        
        return 1;
    else if (spot[1] == spot[5] && spot[5] == spot[9])
        
        return 1;
    else if (spot[3] == spot[5] && spot[5] == spot[7])
        
        return 1;
    
    
    //Game was a draw
    else if (spot[1] != '1' && spot[2] != '2' && spot[3] != '3'
             && spot[4] != '4' && spot[5] != '5' && spot[6] != '6'
             && spot[7] != '7' && spot[8] != '8' && spot[9] != '9')
        
        return 0;
    
    
    //Game still in progress
    else
        return -1;
}



//Function that draws the board
void board()
{
 
    cout << endl << endl << endl;
    
    //Prints each box of the board with the contents of the array properly alligned
    cout << "Player 1 (X)  -  Player 2 (O)" << endl << endl << endl;
    cout << "     |     |     " << endl;
    cout << "  " << spot[1] << "  |  " << spot[2] << "  |  " << spot[3] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << spot[4] << "  |  " << spot[5] << "  |  " << spot[6] << endl;
    cout << "_____|_____|_____" << endl;
    cout << "     |     |     " << endl;
    cout << "  " << spot[7] << "  |  " << spot[8] << "  |  " << spot[9] << endl;
    cout << "     |     |     " << endl << endl;
}


//Method to clear the board & reset all values
void clearBoard(){

    spot[1] = '1';
    spot[2] = '2';
    spot[3] = '3';
    spot[4] = '4';
    spot[5] = '5';
    spot[6] = '6';
    spot[7] = '7';
    spot[8] = '8';
    spot[9] = '9';

}

Writing Sample: The Forgotten Characters

Below are some of the character profiles I’ve written for one of my games “The Forgotten”. More can be read about the universe here.

 

User’s Character

Born after the election, the only life you have ever known is that of the Forgotten. Your life is a constant battle to remain unseen, to remain forgotten. You are only 23, but you are proof that your people still have hope for the future generations. You grew up underground. You’ve been outside one time, when you were 9 and your hideout was discovered by the Safety Force. Other than that, like most others, you have never dared to take such a chance. It was then, when you were 9, that you lost your parents. You have no brothers, no sisters. You were luckily taken in by your closest friend’s family, Teo. Since living with Teo’s family, however, you have learned to be very self sufficient. You often go off on your own in the tunnels to see what you can find. Even as you got older, you couldn’t help the curiosity. And that’s where we join our hero…

 

King Olii

King Olii is a very mysterious man. Some say he was born for the sole purpose to take the throne, a scam put on by the most powerful in all the 5 sisters, but most don’t buy into this nonsense. When he was young, King Olii attended a private school, and was one of the very few who were permitted to travel to Zaki for the sole purpose of studying the Gods. Those closest to Olii say that this was a major turning point in his life. He soon began to study Gaius, the first King of the 5 sisters. He fought his way into politics and soon found himself as one of the closest advisors to the King himself. However, the story gets murky here. The rapid decline of the King soon took place and Olii seemed to fall off the face of the earth for the 2 years which followed. When he returned into the eye of the public, it was to rejoice of the people. Not long after, the King passed away and it was time for the 4th election to take place. As fate had it, Olii was nominated to hold the position along with 2 others. While future Kings are often nominated by the King prior, this was not the case this time. Olii went on to win the election, along with the heart of the people. As the forgotten fled Olii, he let his wrath take hold of him, as is tradition. Buri was flooded, and all planets were plagued by the presence of Olii’s safety force and Bots. Olii has now ruled for 30 years. As King of the 5 sisters, he decides his own agenda. Olii has made some efforts to advance his society with the introduction of the Safety Patrol, and the enactment of many new laws, but his main purpose of his reign thus far has been to eliminate all of the forgotten, by any means he can.

 

King Gaius of Zaki

From what is recorded in the vast libraries of Arne, Gaius was a heroic man. He led the 5 sisters from turmoil after the assassination of the last of Old Kings, and fought off all competitors to the throne. As a revenge towards his competitors, he ordered all their supporters be run out of cities, murdered on the street, and exiled. His rule was one of triumph. He was able to keep all of the sisters content and within check, and rid the planets of most the forgotten. On only his home planet of Zaki were any of the Forgotten spared. He passed away young, but his reign is overall considered very successful.

 

Teo

Teo is an observant girl to say the very least. As part of the forgotten, she has never left her hideout, except once after a raid on the former hideout. She keeps to herself but notices all that goes on around her. Her family is very kind and very hopeful, but it is hard to tell if she retains the same thoughts. While she does put on a strong face, she doesn’t open up enough to anyone for you to truly be sure. You have known her all your life and she is around your age. You and her used to get into mischief together but now she has put that part of her life away. She is preparing to be a teacher at the school for the forgotten, and spends a lot of her time studying.

 

Dr. Bolin

Dr. Bolin is widely considered the leader within your hideout. Bolin is a very kind hearted man. He is best known to those around the hideout for his incredible generosity towards the youth of the community. Dr. Bolin is one of the older men in the hideout. He can often be found painting or drawing using some of the mud or chalk found in the tunnels. Not very much is known about his background, just that he was a pediatrician before the election. His wife was one of the many who fled to Buri after the election. Whether it’s luck or fate, Dr Bolin didn’t follow her that day and he has been hiding out ever since.

 

Groups

The Forgotten

The Forgotten are the group that supported a losing party during the most recent election. As their name states, they wish to remain forgotten. The only hope for those who supported another party after an election is for their kids to survive long enough until the next election ensues and they are no longer the target of such fierce attacks. While most of the forgotten have given up, there is always a fair percent which keep hope. The forgotten are constantly pursued by most outside their community. It is a crime to help a forgotten, so even when people don’t pursue them, they are incredibly reluctant to even be friendly. There are communities of forgotten scattered all across the 5 sisters. They are often easily noticed by the dirty clothes they wear, and their overall state of cleanliness, but if this doesn’t give them away, all Bots and Safety Patrol members are able to access databases which store the identity of all the forgotten.

The Control

Very little is known about The Control. They have been present across the 5 sisters for thousands of years, but didn’t make their way into the spotlight until their assassination of King Gaius. Even after the event, no detective in all the 5 Sisters has been able to trace down any members involved. Their presence and involvement is often very debated amongst citizens. They strike in mysterious ways with very questionable motives at times. All that is known is there is very suspicious activity in Arne and many blame it on The Control.

Unity Sample: Scripts for Object Interaction in C#

The following are 2 scripts that I have written to allow a user using a first person camera in Unity to interact with “intractable” objects. Right now, the code doesn’t do much, it’s really just a template. If attached to an object with a rigidBody component, the interact script will simply turn the object red when it is within interacting range (in this case, 1 meter) and on the pressing of ‘e’ it will make the object jump.

Essentially, this is just a skeleton for object interaction. Attatching the Select script to the first person camera object and the interact script to an object, such as a door, would enable a user to input an “opening” and “closing” animation to the door when the key ‘e’ is pressed.

While the object is out of range

Screen Shot 2018-01-28 at 11.56.01 AM.png

While the object is in rangeScreen Shot 2018-01-28 at 11.57.11 AM

This object’s specific interactionScreen Shot 2018-01-28 at 12.00.40 PM.png

using UnityEngine;
using System.Collections;

public class Select : MonoBehaviour {
	public RaycastHit hit;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {

		//create a ray from the center of the screen
		Ray ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width/2, Screen.height/2,0));

		//if the ray hits something within 1 meters, do:
		if (Physics.Raycast (ray, out hit, 1)) {

			//Checks to see if Interact script is attatched to the object being looked upon
			if (hit.collider.gameObject.GetComponent () != null) {

				//Calls the OnLookEnter funtion for the object with this script attatched
				hit.collider.gameObject.GetComponent ().OnLookEnter ();

			}
		} 

		//When not being looked at
		else {

			Interact.OnLookExit ();
		}
	}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class Interact : MonoBehaviour {
	static public bool selected = false;

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {

	}

	//When object is within interaction range, Do something
        //Turns the object blue
	public void OnLookEnter(){

		//DO THIS
		//sets the color to blue
		GetComponent ().material.color = Color.blue;

		//sets bool to true
		selected = true;
	}

	//When not being looked at, the bool is set to false
	public static void OnLookExit(){

		selected = false;
	}

	//On key press, do something
        //on the press of key 'e', adjusts the height
	void OnGUI(){

		//event e will be the pressing of the e key
		Event e = Event.current;

		//if e = a keyPress, && a characer 'e', && object is in range
		if(e.isKey && e.character == 'e' && selected){

			//uses the objects rigidbody and adjusts it's height.
			GetComponent().AddForce(Vector3.up*100);
		}

	}
}

Writing Sample: The Forgotten Game Background

We start at a time before time. The creation of the 5 planets we now know as the 5 sisters. As legend has it, the gods created each planet 1 harvest apart, creating entirely unique ecosystems for each one.

Planets

Arne

The first, was Arne. Arne was created closest to the sun. It is a barren wasteland. With no water, Arne is essentially endless sand dunes. Arne rotates much faster than any of the other planets, and it’s days only last for about 4 hours, and it’s nights the same. Arne has very little large settlements, mostly consisting of groups of 2-4 homes in the middle of nowhere.

People: The people who are able to survive shield themselves from the sun by only coming out at night. All other times they live in these forts they make from condensed sand, which creates a stone like material. The people here are notorious for their ability to make it days without food or water, and they are able to survive off the bare minimum essentials. The people, when they do eat, feast upon the rare to find animals of the planet. They wear masks which cover all but their eyes in the hopes of avoiding the wrath of the sun.

Animals: The animals inhabiting Arne are mostly small beasts. All of the large gods fled the land within the first few years. Rodents reign supreme here. Most of the rodents have evolved to eat anything they can find. They gnaw on any wood which may fall from the heavens. They eat sand, foliage, each other, and most importantly, man. The people of Arne must always be weary of where they walk, for if they stumble upon a nest of rodies, they very well may become their next meal. The rodies are small, fast, and dirty. Their eyes glow a bright yellow in the night.

Vex

 

Next came Vex. Vex sits comfortably away from the sun, the optimal distance for human survival. Vex is where our hero begins his story, for Vex is the origin of some events to be discussed later. Vex is unique in its ecosystem, but leans towards a more mediterranean ecosystem, however a large majority of the planet is covered in huge cities. The cities are the center of life in Vex. Anything anyone could ever need can be found in one of it’s cities. Vex is also covered in a fair amount of water.

People: The people of Vex live the best quality of life of all those who live on the 5 sisters. Vex is the government capital of all the planets, and this is mostly because of the utopian qualities it demonstrates. Being by far the most civilised and technologically advanced planet, the people are often well spoken and well off. Those who are not usually end up outside the towering city walls. The people eat well. They keep jobs and respect their government. There has only ever been one crisis in Vex. Crime is low, and the people are happy. Most stay within the walls, but it is not a big deal to leave the city once a harvest or so. The people eat meat and the food from farms. Most of the farms lay directly on the outskirts of a city’s walls, however some farmers do stray from this norm.

Animals: The animals which live in this land are few. Vex is the safest planet, and is renowned for it’s “Safety Force”, which is responsible for keeping all cities clean of pests. But the few animals that do inhabit the land of Vex are unforgiving. Packs of hounds are the most common of these. The hounds are fast, but prefer to stay unseen. The second most common is Ozen. The Ozen were once human but have evolved since the creation along a separate path than the humans. They share similar features, but are a completely separate species at this point. More on the Ozen later. Another threat to some in Vex are the bots sent out by the King Olii to seek out the forgotten who remain outside the city walls. They pose no physical threat to the forgotten, however, upon seeing a member of the forgotten, they seek out the nearest safety force members to alert them of forgotten presence.

 

Zaki

 

Zaki was the third planet to be brought into existence. Zaki sits slightly closer to the sun than Vex. Zaki is a jungle planet. Largely untamed by man, Zaki is a beautiful and peaceful planet. Zaki is said to be the home of most the gods, and for that same reason many natives claim to have encountered giant beasts on long journeys. Zaki is green and gorgeous. The planet consists of 2 masses, said to have been split by the gods at the dawn of man to keep man from ever venturing to the god’s domain. The planet therefore is effectively split down the middle, and the only way to cross the great abyss is by crossing the Bridge of the Gods. No man has ever come back from the god’s side of the planet, therefore all settlements are on the man’s side of the planet, referred to as such. The settlements in Zaki are often centered around a church of a specific god, for the inhabitants are largely religious. There are only a few large cities known within Zaki. What lies on the other side of Bridge of the Gods remains a mystery, however.

People: The people living in Zaki worship the gods for a living. All they speak of are the gods. All they ever are concerned with are the gods and it is for that reason that they placed no votes in the most recent of the elections. For this, many of the people of Zaki are unliked by those of other planets. The people of Zaki often wear face paint. They are amazing survivalists, able to track down many beasts and humans alike. In addition, they rarely ever wear shoes. The people don’t carry any currency and instead tend to be more self sufficient in all their survival needs.

Animals: The animals in Zaki are copious. All types of beasts and critters alike roam these lands. The people live at peace with many of the critters. The beasts, however, tend to attack settlements, and often. The many types of beast hold resemblance to the hounds on Vex, and the springers on Buri. However, it seems that many of these beasts still remain unknown. The gods which some claim to have seen have been recorded to take the shape of some of the common animals inhabiting this region. Ozen have been recorded to live here but are not common by any means.

 

Buri

 

Buri is the fourth planet of the sisters. Buri is the second farthest planet from the sun. Buri is the only planet to ever attempt to withdraw from the sisters, in disagreeance with the result of the 3rd election. Because of this, many of the forgotten fled to Buri after the 4th election, but fell into a trap set by the new king to rid themselves of the forgotten. The king Olii flooded the planet killing many of the inhabitants, and destroying all established settlements. Because of this, Buri is almost entirely covered in debris scattered water. The settlements that have since popped up are placed upon giant rafts, and have little protection from the springers, a beast which lurks under water, and attacks from below, but is able to live upon land. Buri is not home to many people nor animals, but it’s resources trapped below the surface are plentiful. Some do travel to Buri to gain access to these riches. Buri also has a high population of Safety Force members.

People: The surviving people of Buri are quiet. They mostly keep to themselves. The scale of the disaster which took place here has been too much for many of the people to handle psychologically. All people own a makeshift boat. It is essential to survival. Many fish for food. Others dive deep down to take springer eggs, which are a known delicacy. The people have not fully adapted to this life, however they are known to be skilled negotiators. Only the richest of people on Buri are able to afford to live on one of the few bits of land remaining. These people tend to be incredibly defensive of their land and protect it indefinitely.

Animals: There are many fish who inhabit Buri, but the most common dangerous animal are the springers. Shooting out of the water at high speeds, and being able to fight on land with their claws is a huge advantage to them. Other than springers, there are not many surviving threats to the humans living there. Near land, there tends to be more birds in the air.

 

Hau

 

Hau was the final planet created by the gods, on the final harvest. Hau is also the furthest planet from the sun. Hau is mostly frozen over, and completely covered in snow. Despite this, it is a fairly lively planet. Hau is known best for it’s feasts. Hau celebrates at any chance that they can, and they do so in huge ways. Huge dining halls in every city is where you are most likely to find anyone you are looking for. It is this mentality that makes the planet feel very welcoming to strangers. Life in Hau is eventful, simple, and above average. The simplicity comes mostly from the lack of technology to have reached them. The people still ride animals, chop wood, and even read. The people stay warm with huge bonfires within city walls, and are always seeking out more wood to keep the flame ablaze.

People: The people of Hau are kind, welcoming, and most of all, happy. Never to be caught without a mead nearby, they live a much simpler life than those on other planets. But this does not make them stupid. It is this style of life that allows them to all stay in top physical shape. Most of the people survive by hunting some of the many wildlife that live beyond city walls. They often wield traditional weapons such as guns, or even bows and arrows. Many of the men grow beards while the women also remain incredibly fit. The best way for the people of Hau to stay warm is the accumulation of many beast’s pelts over their shoulders, worn as almost a vest.

Animals: The animals in Hau are innumerous. Although Ozen have taken many parts of the planet, the majority of beasts on this planet are white to better blend in with the snowy weather. One of the most common of these beasts are the Marus. The marus have huge white tusks and although not fast, they are strong. They have no arms or legs, but fins. They are proficient swimmers as well, but they are most dangerous at close range.

After the creation of the 5 sisters, the gods created man, and then went into hiding. While some do insist that they reside on the other side of The God’s Bridge in Zaki, this is not known for sure. The first planet inhabited by men was Vex. Here, man thrived and quickly advanced. Over 10,000 years ago, man began to venture from Vex, to live on the other planets. They all quickly adapted to their environments and evolved to best survive in their respective situations. The system of government had been the same for as long as man could remember. The king ruled over all subjects in his or her domain, which was expanded to include the other planets once necessary. This continued until only 300 years ago, when the king was assassinated by a group only known as The Control.

The 5 sisters plunged into chaos, in utter disbelief of recent events. But soon, a new king arose. King Gaius of Zaki took the throne. A new system was established. One which was meant to preserve the lifestyle of all inhabitants of the 5 sisters. It enacted an election upon the death or resignation of the king. It required that every single citizen cast a public vote for one of 2 predetermined candidates. Since Gaius had already taken the throne, he declared himself the victor of the first election, and had all opposition run out of cities, and prosecuted as criminals. Public executions, mass graves, and rallies of hatred began to take place throughout the 5 sisters, except on Zaki. And so it was.

The 2nd election was around 260 years ago. The retaliation towards the losers was swift and powerful. It had become a new norm. Killed on the street, run out of cities, left for dead, the losers of the election became the Forgotten. The 3rd election was about 140 years ago. Buri made an attempt after the election to leave the 5 sisters and be a standalone governing body. This notion received no support from the other planets. Come the 4th election, many of the forgotten though that Buri would be a safe place to hide from the treachery that would soon ensue, but instead found themselves in a trap set by the new king, King Olii. This trap killed many of the forgotten. While nobody knows exactly where all the forgotten hide, the hideout that we find our hero in is in Vex, underground in the furthest outskirts of the planet.

Beast Guide

 

  • Rodies
    • Present on all planets, mostly Arne.
    • Small rodent like critters
    • Yellow Glowing Eyes
    • Small, fast, dirty
    • Eat anything
    • Set traps for humans
    • Always travel in groups
  • Hounds
    • Present Everywhere but Arne and Buri
    • Wolf like creatures
    • Quick, strong, intelligent
    • Always travel in packs
  • Ozen
    • Present all planets
    • Human like features
    • Strong
    • Travel in packs,
    • Diverged along separate evolutionary path
  • Bots
    • Present all planets
    • Serve the king
    • Don’t attack, but alert others
    • Travel alone
    • Tough to kill
  • Safety Patrol
    • Present on all planets
    • Squads sent out by King Olii to pursue the Forgotten
    • Use weapons
    • Have armor
    • Travel in packs
  • God Beasts
    • Present on Zaki
    • Rumored to exist but never reliably recorded
    • Giant, beautiful beasts
    • Strong and sometimes aggressive
  • Springers
    • Present on all planets but Arne and Vex
    • Live in both water and land
    • Use claws and fast attacks as weapons
    • Travel in packs
  • Marus
    • Present on all planets but Arne and Vex and Buri
    • Look like fat walrus
    • Live both water and land
    • Incredibly strong, not smart
    • Travel in small groups

The other animals that inhabit this universe are much like those in our own world. Most are not aggressive but some can be at times.

Unity Sample: Player Shoot Method

Below is a simple framework for identifying what a player “shoots” at. A click on an object in unity will send a message to the log if an object is stuck by the “bullet”. If no object is struck, nothing will happen. From this framework we could very simply apply damage to the object struck, as well as any other desired effects upon shooting an object or player. The Serialized Field PlayerWeapon is where you could establish the damage, range, fire rate, and other unique attributes of each weapon object.

 

using UnityEngine;

public class PlayerShoot : MonoBehaviour {

[SerializeField]
private PlayerWeapon weapon;

[SerializeField]
private Camera cam;

[SerializeField]
private LayerMask mask;

void Start () {
if (cam == null)
{
Debug.LogError ("No camera referenced in PlayerShoot");
this.enabled = false;
}
}

void Update () {
if (Input.GetButtonDown ("Fire1"))
{
Shoot ();
}
}

void Shoot () {
RaycastHit _hit;
// If we hit something
if (Physics.Raycast (cam.transform.position, cam.transform.forward, out _hit, weapon.range, mask))
{
EnemyShot (_hit.collider.name);
}
}

void EnemyShot (string _colliderName) {
Debug.Log ("Enemy " + _colliderName + " has been Shot");
}
}


 

Game Sample: 9

Hey! Below is the source code to a simple game I created a few years back as a final project for my AP CS class. It’s written in java and was inspired by the game “A Dark Room”, created by Amir Rajan & released in 2013.

Below is some gameplay!

Screen Shot 2018-01-26 at 4.19.48 PMScreen Shot 2018-01-26 at 4.23.17 PMScreen Shot 2018-01-26 at 4.24.31 PM

Very simple but an interesting play! Here is the code:

<pre>
import java.util.Scanner;
import java.awt.event.*;
public class GameMain
{
 /**
  * Main runs intro sequence and then calls <code> explore </code> method
  */
    public static void main(String []args)
   {
       System.out.println("WELCOME to 9");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println("Instructions: use w,d,s,a and 'Enter' to guide yourself through missions.");
       System.out.println("(Make sure your window fits the entire map) ");
       System.out.println(" ");
       System.out.println("Object guide:");
       System.out.println("1: you");
       System.out.println("2: home");
       System.out.println("3: northern base");
       System.out.println("4: southern wall");
       System.out.println("5: hospital");
       System.out.println("6: market");
       System.out.println("7: motel");
       System.out.println("8: object");
       System.out.println("9: family");
       System.out.println("(type any of these numbers at any time in the game for a quick reminder)");
       System.out.println(" ");
       System.out.println("When you are ready to begin, type 'start'");
       Scanner start = new Scanner(System.in);
       String begin = start.next();
       if(begin.indexOf("start") >= 0)
       {
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
       System.out.println(" ");
           try {
      Thread.sleep(7000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
       System.out.println("It's dark here...");
              System.out.println(" ");
       try {
      Thread.sleep(7000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
      System.out.println("It wasn't always like this.");
      try {
      Thread.sleep(7000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.print("My home...");
           try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("My family...");
     try {
      Thread.sleep(7000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     explore();
    }
}
    public static void explore()
   {
    int[][] myArray = {
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0  },
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
    {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} };  

    int[][] myMapKey = {
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2},
    {2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2},
    {2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,8,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9,2,2,2,2,2,2,2},
    {2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2} };
    for(int print1 = 0; print1 < 26; print1++ )
    {
        for(int print2 = 0; print2 < 40; print2++)
        {
            System.out.print(myArray[print1][print2]);
            System.out.print(" ");
        }
        System.out.println(" ");
    }
   System.out.println("energy = 20");
   boolean first = true;
   boolean exploring = true;
   int currentRep = 0;
   int currentCount = 0;
   int energy = 19;
   int progress = 0;
   int clue = 0;
   int food = 5;
   int finish = 0;
    while(first == true)
    {
    int xx = 23;
    int yy = 9;
    myArray = move(xx,yy, myArray);
    mapPrint(myArray, energy, progress);
    energy --;
    first = false;
   }

   while(exploring == true)
   {
       for(int rep = 0; rep < 26; rep ++)
       {
           for(int count = 0; count < 40; count++)            {                if(myArray[rep][count] == 1)                {                    currentRep = rep;                    currentCount = count;                 }             }         }        if(energy > -1 && progress <= 5)       {         myArray = move(currentRep,currentCount, myArray);        mapPrint(myArray, energy, progress);        myArray = significance(currentCount, currentRep, myArray, progress);        energy = energizer(energy, currentCount,currentRep, progress);        progress = progress(progress,currentCount, currentRep);        energy --;               }       if(energy > -1 && progress >= 6 && clue < 20)       {           myArray = advancedMove(currentRep, currentCount, myArray, myMapKey);           mapPrint2(myArray, energy, food);           clue = clue(currentCount, currentRep, myMapKey, clue);           energy = home(energy,currentCount, currentRep);           food = foodSupply(currentCount, currentRep, food);           energy --;         }       if(clue == 20 && finish == 0)       {           myArray = finalMove(currentRep, currentCount, myArray, myMapKey);           mapPrint2(myArray, energy, food);           energy = home(energy,currentCount, currentRep);           food = foodSupply(currentCount, currentRep, food);           finish = family(currentCount, currentRep, finish);           energy --;         }       if(finish == 1)       {           gameFinish();           exploring = false;         }       if(energy == -1)       {           gameOver();           exploring = false;         }       if(food == 0)       {           starve();           exploring = false;         }     } } public static int[][] move(int x, int y, int[][] myNewArray)  {      Scanner input2 = new Scanner(System.in);      String direction = input2.next();      boolean moving = true;      boolean answered = false;      while(moving == true)      {          if(direction.indexOf("w") >= 0 && myNewArray[x-1][y] != 4)
         {
         myNewArray[x][y] = 0;
         myNewArray[x-1][y] = 1;
         answered = true;
         moving = false;
        }
        if(direction.indexOf("d") >= 0 && myNewArray[x][y+1] != 4)
        {
            myNewArray[x][y] = 0;
            myNewArray[x][y+1] = 1;
            answered = true;
            moving = false;
        }
        if(direction.indexOf("s") >= 0 && myNewArray[x+1][y] != 4)
        {
            myNewArray[x][y] = 0;
            myNewArray[x+1][y] = 1;
            answered = true;
            moving = false;
        }
        if(direction.indexOf("a") >= 0 && myNewArray[x][y-1] != 4)
        {
            myNewArray[x][y] = 0;
            myNewArray[x][y-1] = 1;
            answered = true;
            moving = false;
        }
        if(direction.indexOf("1") >= 0)
        {
            System.out.println(" This is you.");
            direction = input2.next();
        }
        if(direction.indexOf("2") >= 0)
        {
            System.out.println(" This is your old home.");
            direction = input2.next();
        }
        if(direction.indexOf("3") >= 0)
        {
            System.out.println(" This is the base to the north.");
            direction = input2.next();
        }
        if(direction.indexOf("4") >= 0)
        {
            System.out.println(" This is a large wall which surrounded the southern base.");
            direction = input2.next();
        }
        if(direction.indexOf("5") >= 0)
        {
            System.out.println(" This is an old hospital. They must have some medical supplies.");
            direction = input2.next();
        }
        if(direction.indexOf("6") >= 0)
        {
            System.out.println(" This is the old market. I'll visit here when my food supply is low.");
            direction = input2.next();
        }
        if(direction.indexOf("7") >= 0)
        {
            System.out.println(" This is an old motel, and my current refuge. Here i can replenish my energy.");
            direction = input2.next();
        }
        if(direction.indexOf("8") >= 0)
        {
            System.out.println(" This is an object. It could possibly help me find them..");
            direction = input2.next();
        }
        if(direction.indexOf("9") >= 0)
        {
            System.out.println(" My Family..");
            direction = input2.next();
        }
        /*if(answered = false)
        *{
        *   System.out.println("Invalid");
        *   direction = input.next();
        *}
        */
    }
     return myNewArray;
    }
public static int[][] mapPrint(int[][]myArray, int energy, int progress)
{
    for(int print1 = 0; print1 < 26; print1++ )
    {
        for(int print2 = 0; print2 < 40; print2++)         {             System.out.print(myArray[print1][print2]);             System.out.print(" ");         }         System.out.println(" ");     }     if(progress >= 1)
    {
        myArray[10][5] = 2;
    }
    if(progress >= 2)
    {
        myArray[4][14] = 3;
    }
    if(progress >= 3)
    {
        myArray[22][20] = 4;
        myArray[22][21] = 4;
        myArray[23][20] = 4;
        myArray[24][20] = 4;
        myArray[25][20] = 4;
        myArray[22][22] = 4;
        myArray[22][23] = 4;
        myArray[22][24] = 4;
        myArray[22][25] = 4;
        myArray[22][26] = 4;
        myArray[22][27] = 4;
        myArray[22][28] = 4;
        myArray[22][29] = 4;
        myArray[22][30] = 4;
        myArray[22][31] = 4;
        myArray[22][31] = 4;
        myArray[22][32] = 4;
        myArray[22][33] = 4;
        myArray[22][34] = 4;
        myArray[22][35] = 4;
        myArray[22][36] = 4;
        myArray[22][37] = 4;
        myArray[22][38] = 4;
        myArray[22][39] = 4;
    }
    if(progress >= 4)
    {
        myArray[14][15] = 5;
    }
    if(progress >= 5)
    {
        myArray[9][34] = 6;
    }
    if(progress >=6)
    {
        myArray[17][10] = 7;
    }
    if(energy >= 4)
    {
        System.out.println("energy = " + energy);
    }
    if(energy < 4)
    {
        System.out.println("ENERGY = " + energy);
    }
    return myArray;
}
public static int[][] significance(int xSpot, int ySpot, int[][] nextLocation, int progress)
{
    if(xSpot == 5 && ySpot == 10 &&  progress == 0)
    {
        System.out.println("I can't believe what this world has come to...");
                   try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
        System.out.println(" ");
        System.out.println("an engraving on the wall reads:");
        System.out.println("'To the north we are safe.'");
                   try {
      Thread.sleep(7000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("I must go to the north base");
                     try {
      Thread.sleep(3000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     nextLocation[4][15] = 3;
     System.out.println("Energy replenished");
     System.out.println("(Exit to the North)");
     progress++;
     return nextLocation;
    }
    if(xSpot == 14 && ySpot == 4 && progress == 1)
    {
     System.out.println("More wreckage..");
                           try {
      Thread.sleep(6000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("The North is nothing now.");
     System.out.println(" ");
                        try {
      Thread.sleep(3000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("It makes me wonder of the south...");
                        try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     nextLocation[22][20] = 4;
     System.out.println("Energy upgraded");
     System.out.println("(Exit to the South)");
     progress++;
     return nextLocation;
    }
    if(xSpot == 18 && ySpot == 21 && progress == 2 || xSpot == 19 && ySpot == 22 && progress == 2 || xSpot == 18 && ySpot == 22 && progress == 2)
    {
     System.out.println("It's hard to believe how much has changed..");
                                   try {
      Thread.sleep(6000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("A huge wall seperates me from the far south now..");
                                try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("There used to be a hospital around here.. Maybe they're safe...");
                                try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     nextLocation[14][14] = 5;
     System.out.println("Energy replenished");
     System.out.println("(Exit to the North)");
     progress++;
     return nextLocation;

    }
    if(xSpot == 15 && ySpot == 14 && progress == 3)
    {
        System.out.println("How can I be the only one?");
         try {
      Thread.sleep(6000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("The only..");
      try {
      Thread.sleep(1500);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("Survivor.?");
      try {
      Thread.sleep(5000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("To survive I must find food..");
      try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     nextLocation[9][34] = 6;
     System.out.println("Energy upgraded");
     System.out.println("(Exit to the North)");
     progress++;
     return nextLocation;
    }
    if(xSpot == 33 && ySpot == 9 && progress == 4)
    {
     System.out.println("The world has been brought to nothing..");
     try {
      Thread.sleep(6000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("I can only carry enough food for 5 days..");
     System.out.println("A place to take refuge is necesary.");
      try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     nextLocation[17][10] = 7;
     System.out.println("Energy upgraded");
     System.out.println("(Exit to the South)");
     progress++;
     return nextLocation;
    }
    if(xSpot == 11 && ySpot == 17 && progress == 5)
    {
        System.out.println("This motel will suffice.");
        System.out.println(" ");
         try {
      Thread.sleep(6000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("I am starting to feel the effects of the radiation..");
      try {
      Thread.sleep(3000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("I can only imagine how they feel...");
      try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("My search truly begins here.");
      try {
      Thread.sleep(2000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("This will be my home for now. Here I will rest after each day.");
     System.out.println("But only for now..");
     System.out.println(" ");
      try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("(Find clues (8) in order to find your family");
     System.out.println("All clues are different. Some can only be seen from an angle..");
     System.out.println("Some aren't clues at all.");
     System.out.println("The '8' only represents an area in which a possible clue is near.");
     System.out.println("Therefore, be sure to search the immediate surrounding area as well.");
       try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println(" ");
     System.out.println("As winds speed up, the dust of everything that once was has limited your vision.");
     System.out.println("The '2' now represents explored territory as well as range of vision.)");
       try {
      Thread.sleep(4000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("(Exit to the North)");
     progress++;
     return nextLocation;
    }
    else
    {
     return nextLocation;
    }
}

public static int energizer(int energy,int xSpot, int ySpot, int progress)
{
  if(xSpot == 5 && ySpot == 10)
  {
      return 20;
    }
  if(xSpot == 14 && ySpot == 4 && progress == 1)
  {
      return 25;
    }
  if(xSpot == 19 && ySpot == 22 && progress == 2 || xSpot == 18 && ySpot == 21 && progress == 2 || xSpot == 18 && ySpot == 22 && progress == 2)
  {
      return 25;
    }
  if(xSpot == 15 && ySpot == 14 && progress == 3)
  {
      return 30;
    }
  if(xSpot == 33 && ySpot == 9 && progress == 4)
  {
      return 35;
    }
  if(xSpot == 11 && ySpot == 17 && progress == 5)
  {
      return 40;
    }
    else
    {
        return energy;
    }
}
public static int progress(int progress, int xSpot, int ySpot)
{
    if(xSpot == 5 && ySpot == 10)
    {
        progress++;
    }
    if(xSpot == 14 && ySpot == 4 && progress == 1)
    {
        progress++;
    }
    if(xSpot == 19 && ySpot == 22 && progress == 2 || xSpot == 18 && ySpot == 21 && progress == 2 || xSpot == 18 && ySpot == 22 && progress == 2)
    {
        progress++;
    }
    if(xSpot == 15 && ySpot == 14 && progress == 3)
    {
        progress++;
    }
    if(xSpot == 33 && ySpot == 9 && progress == 4)
    {
        progress++;
    }
    if(xSpot == 11 && ySpot == 17 && progress == 5)
    {
        progress++;
    }
    return progress;
}
public static int[][] mapPrint2(int[][]myArray, int energy, int food)
{
    for(int print1 = 0; print1 < 26; print1++ )
    {
        for(int print2 = 0; print2 < 40; print2++)         {             System.out.print(myArray[print1][print2]);             System.out.print(" ");         }         System.out.println(" ");     }     myArray[10][5] = 2;     myArray[4][14] = 3;     myArray[22][20] = 4;     myArray[22][21] = 4;     myArray[23][20] = 4;     myArray[24][20] = 4;     myArray[25][20] = 4;     myArray[22][22] = 4;     myArray[22][23] = 4;     myArray[22][24] = 4;     myArray[22][25] = 4;     myArray[22][26] = 4;     myArray[22][27] = 4;     myArray[22][28] = 4;     myArray[22][29] = 4;     myArray[22][30] = 4;     myArray[22][31] = 4;     myArray[22][31] = 4;     myArray[22][32] = 4;     myArray[22][33] = 4;     myArray[22][34] = 4;     myArray[22][35] = 4;     myArray[22][36] = 4;     myArray[22][37] = 4;     myArray[22][38] = 4;     myArray[22][39] = 4;     myArray[14][15] = 5;     myArray[9][34] = 6;     myArray[17][10] = 7;       if(energy >= 4)
    {
        System.out.println("energy = " + energy);
    }
    if(energy < 4)     {         System.out.println("ENERGY = " + energy);     }     if(food > 2)
    {
        System.out.println("food supply = " + food + " days");
    }
     if(food <= 2)     {         System.out.println("food supply = " + food + " days");         System.out.println("food supply dangerously low!");     }     return myArray; } public static int[][] advancedMove(int x, int y, int[][] myNewArray, int[][] keyMap) {     Scanner input = new Scanner(System.in);      String direction = input.next();      boolean moving = true;      boolean answered = false;      while(moving == true)      {          if(direction.indexOf("w") >= 0 && myNewArray[x-1][y] != 4)
         {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x-1][y] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x][y+1] == 0)
        {
         myNewArray[x][y+1] = keyMap[x][y+1];
        }
        if(myNewArray[x][y-1] == 0)
        {
         myNewArray[x][y-1] = keyMap[x][y-1];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
        if(myNewArray[x+1][y] == 0)
        {
            myNewArray[x+1][y] = keyMap[x+1][y];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("d") >= 0 && myNewArray[x][y+1] != 4)
        {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x][y+1] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x-1][y] == 0)
        {
         myNewArray[x-1][y] = keyMap[x-1][y];
        }
        if(myNewArray[x][y-1] == 0)
        {
         myNewArray[x][y-1] = keyMap[x][y-1];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
        if(myNewArray[x+1][y] == 0)
        {
            myNewArray[x+1][y] = keyMap[x+1][y];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("s") >= 0 && myNewArray[x+1][y] != 4)
        {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x+1][y] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x][y+1] == 0)
        {
         myNewArray[x][y+1] = keyMap[x][y+1];
        }
        if(myNewArray[x][y-1] == 0)
        {
         myNewArray[x][y-1] = keyMap[x][y-1];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("a") >= 0 && myNewArray[x][y-1] != 4)
        {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x][y-1] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x-1][y] == 0)
        {
         myNewArray[x-1][y] = keyMap[x][y+1];
        }
        if(myNewArray[x-1][y] == 0)
        {
         myNewArray[x-1][y] = keyMap[x-1][y];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
        if(myNewArray[x+1][y] == 0)
        {
            myNewArray[x+1][y] = keyMap[x+1][y];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("1") >= 0)
        {
            System.out.println(" This is you.");
            direction = input.next();
        }
        if(direction.indexOf("2") >= 0)
        {
            System.out.println(" This is your old home. This also will represent your vision/ explored territory.");
            direction = input.next();
        }
        if(direction.indexOf("3") >= 0)
        {
            System.out.println(" This is the base to the north.");
            direction = input.next();
        }
        if(direction.indexOf("4") >= 0)
        {
            System.out.println(" This is a large wall which surrounded the southern base.");
            direction = input.next();
        }
        if(direction.indexOf("5") >= 0)
        {
            System.out.println(" This is an old hospital. They must have some medical supplies.");
            direction = input.next();
        }
        if(direction.indexOf("6") >= 0)
        {
            System.out.println(" This is the old market. I'll visit here when my food supply is low.");
            direction = input.next();
        }
        if(direction.indexOf("7") >= 0)
        {
            System.out.println(" This is an old motel, and my current refuge. Here i can replenish my energy.");
            direction = input.next();
        }
        if(direction.indexOf("8") >= 0)
        {
            System.out.println(" This is a clue, necesary for finding them.");
            direction = input.next();
        }
        if(direction.indexOf("9") >= 0)
        {
            System.out.println(" My Family..");
            direction = input.next();
        }

    }
     return myNewArray;
}
public static int[][] finalMove(int x, int y, int[][] myNewArray, int[][] keyMap)
{
    Scanner input = new Scanner(System.in);
     String direction = input.next();
     boolean moving = true;
     boolean answered = false;
     while(moving == true)
     {
         if(direction.indexOf("w") >= 0)
         {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x-1][y] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x][y+1] == 0)
        {
         myNewArray[x][y+1] = keyMap[x][y+1];
        }
        if(myNewArray[x][y-1] == 0)
        {
         myNewArray[x][y-1] = keyMap[x][y-1];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
        if(myNewArray[x+1][y] == 0)
        {
            myNewArray[x+1][y] = keyMap[x+1][y];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("d") >= 0)
        {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x][y+1] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x-1][y] == 0)
        {
         myNewArray[x-1][y] = keyMap[x-1][y];
        }
        if(myNewArray[x][y-1] == 0)
        {
         myNewArray[x][y-1] = keyMap[x][y-1];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
        if(myNewArray[x+1][y] == 0)
        {
            myNewArray[x+1][y] = keyMap[x+1][y];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("s") >= 0)
        {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x+1][y] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x][y+1] == 0)
        {
         myNewArray[x][y+1] = keyMap[x][y+1];
        }
        if(myNewArray[x][y-1] == 0)
        {
         myNewArray[x][y-1] = keyMap[x][y-1];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("a") >= 0)
        {
         myNewArray[x][y] = keyMap[x][y];
         myNewArray[x][y-1] = 1;
         if(myNewArray[x-2][y] == 0)
         {
         myNewArray[x-2][y] = keyMap[x-2][y];
        }
        if(myNewArray[x-3][y] == 0)
        {
          myNewArray[x-3][y] = keyMap[x-3][y];
        }
        if(myNewArray[x-1][y-1] == 0)
        {
         myNewArray[x-1][y-1] = keyMap[x-1][y-1];
        }
        if(myNewArray[x+1][y+1] == 0)
        {
         myNewArray[x+1][y+1] = keyMap[x+1][y+1];
        }
        if(myNewArray[x-1][y+1] == 0)
        {
         myNewArray[x-1][y+1] = keyMap[x-1][y+1];
        }
         if(myNewArray[x+1][y-1] == 0)
        {
         myNewArray[x+1][y-1] = keyMap[x+1][y-1];
        }
        if(myNewArray[x-1][y] == 0)
        {
         myNewArray[x-1][y] = keyMap[x][y+1];
        }
        if(myNewArray[x-1][y] == 0)
        {
         myNewArray[x-1][y] = keyMap[x-1][y];
        }
        if(myNewArray[x][y+2] == 0)
        {
         myNewArray[x][y+2] = keyMap[x][y+2];
        }
        if(myNewArray[x][y-2] == 0)
        {
         myNewArray[x][y-2] = keyMap[x][y-2];
        }
        if(myNewArray[x+1][y] == 0)
        {
            myNewArray[x+1][y] = keyMap[x+1][y];
        }
         answered = true;
         moving = false;
        }
        if(direction.indexOf("1") >= 0)
        {
            System.out.println(" This is you.");
            direction = input.next();
        }
        if(direction.indexOf("2") >= 0)
        {
            System.out.println(" This is your old home. This also will represent your vision/ explored territory.");
            direction = input.next();
        }
        if(direction.indexOf("3") >= 0)
        {
            System.out.println(" This is the base to the north.");
            direction = input.next();
        }
        if(direction.indexOf("4") >= 0)
        {
            System.out.println(" This is a large wall which surrounded the southern base.");
            direction = input.next();
        }
        if(direction.indexOf("5") >= 0)
        {
            System.out.println(" This is an old hospital. They must have some medical supplies.");
            direction = input.next();
        }
        if(direction.indexOf("6") >= 0)
        {
            System.out.println(" This is the old market. I'll visit here when my food supply is low.");
            direction = input.next();
        }
        if(direction.indexOf("7") >= 0)
        {
            System.out.println(" This is an old motel, and my current refuge. Here i can replenish my energy.");
            direction = input.next();
        }
        if(direction.indexOf("8") >= 0)
        {
            System.out.println(" This is a clue, necesary for finding them.");
            direction = input.next();
        }
        if(direction.indexOf("9") >= 0)
        {
            System.out.println(" My Family..");
            direction = input.next();
        }

    }
     return myNewArray;
}
public static int clue(int y, int x, int[][] key, int clue)
{

    if(key[x][y] == 8)
    {
        clue++;
        key[x][y] = 0;
    }
        if(clue == 1)
      {
      System.out.println("The remains of some sort of animal.. it makes me sick to my stomach");
      clue++;
     }
     if(clue == 3)
     {
        System.out.println("Death is everywhere..");
        clue++;
     }
     if(clue == 5)
     {
        Scanner input20 = new Scanner(System.in);
        String choice = input20.next();
        System.out.println("A man. He looks so ill..");
        System.out.println("I have a choice to make:");
        System.out.println(" ");
        System.out.println("(a) I give him a day's worth of my food.");
        System.out.println("(b) I leave him to die.");
        System.out.println(" ");
        if(choice.indexOf("a")>=0)
        {
            System.out.println("The man's eyes flutter, and he asks to be left to die.");
        }
        if(choice.indexOf("b")>=0)
        {
            System.out.println("As I'm walking away, the world feels quieter than ever.");
        }
        clue++;
     }
     if(clue == 7)
     {
         System.out.println("Ever since 'the end', these burrows seem to have popped up everywhere.");
         clue++;
        }
     if(clue == 9)
     {
         System.out.println("This bracelet smells exactly like home... It was one of theirs.");
         clue++;
        }
     if(clue == 11)
     {
         System.out.println("A single tree..");
         clue++;
        }
     if(clue == 13)
     {
         System.out.println("Dogs, resorted to their primal instinct. Their meal looks too familiar.");
         clue++;
        }
     if(clue == 15)
     {
         System.out.println("These are her shoes. I'm absolutely sure of it. They're covered in mud.");
         clue++;
        }
     if(clue == 17)
     {
         System.out.println("Blood. It's not theirs. It's not theirs..");
         clue++;
        }
     if(clue == 19)
     {
         System.out.println("A tattered piece of paper. it's addressed to me..");
         System.out.println("'South'. thats all it says. How do i get past the wall. How.");
         finalThoughts();
         clue++;
        }

    return clue;
}
public static int home(int energy, int xSpot, int ySpot)
{
    if(xSpot == 10 && ySpot == 18)
    {
        System.out.println("Home sweet home..");
        System.out.println("(exit to the east or west)");
        energy = 50;
    }
    if(xSpot == 33 && ySpot == 9)
    {
        energy = 50;
    }
    return energy;
}
public static int foodSupply(int xSpot, int ySpot, int food)
{
    if(xSpot == 11 && ySpot == 17 && food > 0)
    {
        food --;
    }
    if(xSpot == 11 && ySpot == 17 && food == 0)
    {
        starve();
    }
    if(xSpot == 33 && ySpot == 9 && food <span 				data-mce-type="bookmark" 				id="mce_SELREST_start" 				data-mce-style="overflow:hidden;line-height:0" 				style="overflow:hidden;line-height:0" 			></span>< 5)
    {
        System.out.println( 5 - food + " more days worth of food. Good.");
        food = 5;
    }
    return food;
}
public static int family(int xSpot, int ySpot, int finish)
{
    if(xSpot == 32 && ySpot == 24)
    {
        finish = 1;
    }
    return finish;
}
public static void finalThoughts()
{
    System.out.println(" ");
    System.out.println("it's so tall...");
    try {
      Thread.sleep(3000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
    System.out.println("But nothing will keep me from them. I know what I must do.");
}
public static void gameOver()
{
    System.out.println("ENERGY = 0");
    System.out.println("GAME OVER");
}
public static void starve()
{
    System.out.println("You lack the necesary food to venture on.");
    System.out.println("GAME OVER");
}
public static void gameFinish()
{
    System.out.print("My");
    try {
      Thread.sleep(1000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.print(".");
     try {
      Thread.sleep(1000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.print(".");
       try {
      Thread.sleep(1000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.print(".");
            try {
      Thread.sleep(3000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("family..");
                 try {
      Thread.sleep(7000);
     } catch(InterruptedException ex) {
      Thread.currentThread().interrupt();
     }
     System.out.println("I'm Home.");
}
}
</pre>