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

 

One thought on “Game Sample: Tic Tac Toe AI

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Connecting to %s