// Methods to Go Into another class for probability mathematics 
        #region WinningConditions
        public void WinningConditions()
        {
            // to calculate the winning conditions for the player based on the winning conditions 
            // of a usual tic tac to game. algorithims all by Jimmy Ellis
            // tic tac toe three in a row row 1  left to right, row 2 left to right, row 3 left to right


            #region Algorithim: row1x1, row1x2, row1x3 win
            if ((isLocationUsed[0, 0] == true) && (isLocationUsed[0, 1] == true) && (isLocationUsed[0, 2] == true))
            {

                if ((locationUsedByX[0, 0] == true) && (locationUsedByX[0, 1] == true) && (locationUsedByX[0, 2] == true))
                {
                    winningformation = WinningFormation.row1win;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[0, 0] == true) && (locationUsedByO[0, 1] == true) && (locationUsedByO[0, 2] == true))
                {

                    winningformation = WinningFormation.row1win;
                    winner = Winner.owins;
                }


            }
            #endregion

            #region Algorithim: row 2x1, 2x2, 2x3 win
            if ((isLocationUsed[1, 0] == true) && (isLocationUsed[1, 1] == true) && (isLocationUsed[1, 2] == true))
            {
                if ((locationUsedByX[1, 0] == true) && (locationUsedByX[1, 1] == true) && (locationUsedByX[1, 2] == true))
                {
                    winningformation = WinningFormation.row2win;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[1, 0] == true) && (locationUsedByO[1, 1] == true) && (locationUsedByO[1, 2] == true))
                {

                    winningformation = WinningFormation.row2win;
                    winner = Winner.owins;
                }
            }
            #endregion

            #region Algorithim: row 3x1, 3x2, 3x3
            if ((isLocationUsed[2, 0] == true) && (isLocationUsed[2, 1] == true) && (isLocationUsed[2, 2] == true))
            {
                if ((locationUsedByX[2, 0] == true) && (locationUsedByX[2, 1] == true) && (locationUsedByX[2, 2] == true))
                {
                    winningformation = WinningFormation.row3win;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[2, 0] == true) && (locationUsedByO[2, 1] == true) && (locationUsedByO[2, 2] == true))
                {

                    winningformation = WinningFormation.row3win;
                    winner = Winner.owins;
                }

            }
            #endregion
            // end tic tac toe column win

            // tic tac toe column win column 1, 2, and 3
            #region Algorithim: row 1x1, row2x1, row3x1
            if ((isLocationUsed[0, 0] == true) && (isLocationUsed[1, 0] == true) && (isLocationUsed[2, 0] == true))
            {
                if ((locationUsedByX[0, 0] == true) && (locationUsedByX[1, 0] == true) && (locationUsedByX[2, 0] == true))
                {
                    winningformation = WinningFormation.column1win;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[0, 0] == true) && (locationUsedByO[1, 0] == true) && (locationUsedByO[2, 0] == true))
                {

                    winningformation = WinningFormation.column1win;
                    winner = Winner.owins;
                }
            }
            #endregion
            #region Algorithim: row1x2, 2x2, 3x2
            if ((isLocationUsed[0, 1] == true) && (isLocationUsed[1, 1] == true) && (isLocationUsed[2, 1] == true))
            {
                if ((locationUsedByX[0, 1] == true) && (locationUsedByX[1, 1] == true) && (locationUsedByX[2, 1] == true))
                {
                    winningformation = WinningFormation.column2win;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[0, 1] == true) && (locationUsedByO[1, 1] == true) && (locationUsedByO[2, 1] == true))
                {

                    winningformation = WinningFormation.column2win;
                    winner = Winner.owins;
                }
            }
            #endregion

            #region Algorithim: 1x3, 2x3, 3x3
            if ((isLocationUsed[0, 2] == true) && (isLocationUsed[1, 2] == true) && (isLocationUsed[2, 2] == true))
            {
                if ((locationUsedByX[0, 2] == true) && (locationUsedByX[1, 2] == true) && (locationUsedByX[2, 2] == true))
                {
                    winningformation = WinningFormation.column3win;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[0, 2] == true) && (locationUsedByO[1, 2] == true) && (locationUsedByO[2, 2] == true))
                {

                    winningformation = WinningFormation.column3win;
                    winner = Winner.owins;
                }
            }
            #endregion
            // end tic tac toe column win

            // tic tac toe diagnol win
            #region Algorithim: row1x1, row2x2, row3x3
            if ((isLocationUsed[0, 0] == true) && (isLocationUsed[1, 1] == true) && (isLocationUsed[2, 2] == true))
            {
                if ((locationUsedByX[0, 0] == true) && (locationUsedByX[1, 1] == true) && (locationUsedByX[2, 2] == true))
                {
                    winningformation = WinningFormation.topleftdiagnolwin;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[0, 0] == true) && (locationUsedByO[1, 1] == true) && (locationUsedByO[2, 2] == true))
                {

                    winningformation = WinningFormation.topleftdiagnolwin;
                    winner = Winner.owins;
                }

            }
            #endregion

            #region Algorithim: row1x3, row2x2, row3x1
            if ((isLocationUsed[0, 2] == true) && (isLocationUsed[1, 1] == true) && (isLocationUsed[2, 0] == true))
            {
                if ((locationUsedByX[0, 2] == true) && (locationUsedByX[1, 1] == true) && (locationUsedByX[2, 0] == true))
                {
                    winningformation = WinningFormation.toprightdiagnolwin;
                    winner = Winner.xwins;
                }

                else if ((locationUsedByO[0, 2] == true) && (locationUsedByO[1, 1] == true) && (locationUsedByO[2, 0] == true))
                {

                    winningformation = WinningFormation.toprightdiagnolwin;
                    winner = Winner.owins;
                }

            }
            int count = 0;
            for (int z = 0; z < 3; z++)
            {
                for (int y = 0; y < 3; y++)
                {
                    if (isLocationUsed[z, y] == true)
                    {
                        count++;
                    }


                }
            }

            if (count == 9)
            {
                winningformation = WinningFormation.catgame;
                winner = Winner.catgame;
            }

            #endregion
            // end tic tac toe diagnol win

        }
示例#2
0
        public TicTacToeGameScreen()
        {
            tictactoeAI = new TicTacToeAI();

            turnpiece           = TurnPiece.oturn;
            winningformation    = WinningFormation.nowin;
            gameMouse           = new MouseState();
            blankBackgroundRect = new Rectangle(0, 0, 1024, 720);
            mouseCount          = 0;
            previousState       = new MouseState();
            middleState         = new MouseState();
            hitEnterToReplay    = false;
            pieceSize.X         = 128;
            pieceSize.Y         = 128;
            // the peices rectangles set
            #region Pieces
            xRect    = new Rectangle[9];
            oRect    = new Rectangle[100];
            xRect[0] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[1] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[2] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[3] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[4] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[5] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[6] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[7] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[8] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);

            terminateLoop = false;
            // rectangle pieces
            oRect[0] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[1] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[2] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[3] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[4] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[5] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[6] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[7] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[8] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[9]  = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[10] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[11] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[12] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[13] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[14] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[15] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[16] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[17] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[18] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[19] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[20] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[21] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[22] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[23] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[24] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[25] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[26] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[27] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[28] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[29] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[30] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[31] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[32] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[33] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[34] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[35] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[36] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[37] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[38] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[39] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[40] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[41] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);


            oRect[42] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[43] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[44] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[45] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[46] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[47] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[48] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[49] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[50] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[51] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[52] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[53] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[54] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[55] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[56] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[57] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[58] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[59] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[60] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[61] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[62] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[63] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[64] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[65] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[66] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);


            oRect[60] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[61] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[62] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[63] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[64] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[65] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[66] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[67] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[68] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[69] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[70] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[71] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[72] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[73] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[74] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[75] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[76] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[77] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[78] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[79] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[80] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[81] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[82] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[83] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[84] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[85] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[86] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[87] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[88] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[89] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[90] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[91] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[92] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[93] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[94] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[95] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[96] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[97] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[98] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[99] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            #endregion

            gameBoardRect  = new Rectangle(100, 50, 640, 640);
            mouseCollision = new Rectangle(0, 0, 24, 24);
            // intitalizing the texture array

            // gameboard location is set to empty
            gameboardlocation = GameBoardLocation.empty;

            // locations of each and every piece put into a vector2 array to explicit or implicit conversion to int for rectangular collision
            boxLocations = new Vector2[3, 3];

            boxLocations[0, 0] = new Vector2(150, 100);
            boxLocations[0, 1] = new Vector2(370, 90);
            boxLocations[0, 2] = new Vector2(570, 95);

            boxLocations[1, 0] = new Vector2(140, 290);
            boxLocations[1, 1] = new Vector2(365, 300);
            boxLocations[1, 2] = new Vector2(575, 290);

            boxLocations[2, 0] = new Vector2(155, 520);
            boxLocations[2, 1] = new Vector2(365, 510);
            boxLocations[2, 2] = new Vector2(570, 520);

            // confirm or deny if the location is used or not based on boolean logic algorithim
            tictactoeAI.IsLocationUsed = new bool[3, 3];

            // nested double for loop that initializes all in the multi dimensional array as false for update method
            // deep logical algorithims
            for (int a = 0; a < 3; a++)
            {
                for (int b = 0; b < 3; b++)
                {
                    tictactoeAI.IsLocationUsed[a, b] = false;
                }
            }
            // boolean multi dimensional array to see if x is using the spot
            tictactoeAI.LocationUsedByX = new bool[3, 3];
            for (int a = 0; a < 3; a++)
            {
                for (int b = 0; b < 3; b++)
                {
                    tictactoeAI.LocationUsedByX[a, b] = false;
                }
            }
            // double nested for loop to set all values to false


            // boolean multi dimensional array to see if o is using the spot
            tictactoeAI.LocationUsedByO = new bool[3, 3];
            for (int a = 0; a < 3; a++)
            {
                for (int b = 0; b < 3; b++)
                {
                    tictactoeAI.LocationUsedByO[a, b] = false;
                }
            }

            /* comment only
             * Locations for each field in debug mode
             * textfile that maps locations
             * 1 2 3
             * 4 5 6
             * 7 8 9
             * 1.) x: 150 y: 100
             * 2.) x: 370 y: 90
             * 3.) x: 570 y: 95
             * 4.) x: 140 y: 290
             * 5.) x: 365 y: 300
             * 6.) x: 575 y: 290
             * 7.) x: 155 y: 520
             * 8.) x: 365 y: 510
             * 9.) x: 570 y: 520
             */



            boxCollisionRect = new Rectangle[9];

            boxCollisionRect[0] = new Rectangle((int)boxLocations[0, 0].X, (int)boxLocations[0, 0].Y, 130, 130);
            boxCollisionRect[1] = new Rectangle((int)boxLocations[0, 1].X, (int)boxLocations[0, 1].Y, 130, 130);
            boxCollisionRect[2] = new Rectangle((int)boxLocations[0, 2].X, (int)boxLocations[0, 2].Y, 130, 130);

            boxCollisionRect[3] = new Rectangle((int)boxLocations[1, 0].X, (int)boxLocations[1, 0].Y, 130, 130);
            boxCollisionRect[4] = new Rectangle((int)boxLocations[1, 1].X, (int)boxLocations[1, 1].Y, 130, 130);
            boxCollisionRect[5] = new Rectangle((int)boxLocations[1, 2].X, (int)boxLocations[1, 2].Y, 130, 130);

            boxCollisionRect[6] = new Rectangle((int)boxLocations[2, 0].X, (int)boxLocations[2, 0].Y, 130, 130);
            boxCollisionRect[7] = new Rectangle((int)boxLocations[2, 1].X, (int)boxLocations[2, 1].Y, 130, 130);
            boxCollisionRect[8] = new Rectangle((int)boxLocations[2, 2].X, (int)boxLocations[2, 2].Y, 130, 130);

            /* comment only
             * Locations for each field in debug mode
             * textfile that maps locations
             * 1 2 3
             * 4 5 6
             * 7 8 9
             * 1.) x: 150 y: 100
             * 2.) x: 370 y: 90
             * 3.) x: 570 y: 95
             * 4.) x: 140 y: 290
             * 5.) x: 365 y: 300
             * 6.) x: 575 y: 290
             * 7.) x: 155 y: 520
             * 8.) x: 365 y: 510
             * 9.) x: 570 y: 520
             */
        }
        public TicTacToeAI()
        {

            
            
       
            
            turnpiece = TurnPiece.oturn;
            winningformation = WinningFormation.nowin;
            gameMouse = new MouseState();
            blankBackgroundRect = new Rectangle(0, 0, 1024, 720);
            mouseCount = 0;
            previousState = new MouseState();
            middleState = new MouseState();
            hitEnterToReplay = false;
            pieceSize.X = 128;
            pieceSize.Y = 128;
            // the peices rectangles set
            #region Pieces
            xRect = new Rectangle[9];
            oRect = new Rectangle[100];

            for (int r = 0; r < oRect.Length; r++)
            {
                oRect[r] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            }
            terminateLoop = false;
            /*
            xRect[0] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[1] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[2] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[3] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[4] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[5] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[6] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[7] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);
            xRect[8] = new Rectangle(0, 0, (int)pieceSize.X, (int)pieceSize.Y);

            
            // rectangle pieces 
            oRect[0] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[1] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[2] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[3] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[4] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[5] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[6] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[7] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[8] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[9] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[10] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[11] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[12] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[13] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[14] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[15] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[16] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[17] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[18] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[19] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[20] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[21] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[22] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[23] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[24] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[25] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[26] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[27] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[28] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[29] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[30] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[31] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[32] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[33] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[34] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[35] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[36] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[37] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[38] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[39] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[40] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[41] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);


            oRect[42] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[43] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[44] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[45] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[46] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[47] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[48] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[49] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[50] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[51] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[52] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[53] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[54] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[55] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[56] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[57] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[58] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[59] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[60] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[61] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[62] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[63] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[64] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[65] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[66] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);


            oRect[60] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[61] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[62] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[63] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[64] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[65] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[66] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[67] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[68] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[69] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[70] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[71] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[72] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[73] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[74] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[75] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[76] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[77] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[78] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[79] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[80] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[81] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[82] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[83] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[84] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[85] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[86] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[87] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[88] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[89] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[90] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[91] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[92] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[93] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[94] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);

            oRect[95] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[96] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[97] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[98] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
            oRect[99] = new Rectangle(130, 0, (int)pieceSize.X, (int)pieceSize.Y);
             */
            #endregion

            gameBoardRect = new Rectangle(100, 50, 640, 640);
            mouseCollision = new Rectangle(0, 0, 24, 24);
            // intitalizing the texture array

            // gameboard location is set to empty
            gameboardlocation = GameBoardLocation.empty;

            // locations of each and every piece put into a vector2 array to explicit or implicit conversion to int for rectangular collision
            boxLocations = new Vector2[3, 3];

            boxLocations[0, 0] = new Vector2(150, 100);
            boxLocations[0, 1] = new Vector2(370, 90);
            boxLocations[0, 2] = new Vector2(570, 95);

            boxLocations[1, 0] = new Vector2(140, 290);
            boxLocations[1, 1] = new Vector2(365, 300);
            boxLocations[1, 2] = new Vector2(575, 290);

            boxLocations[2, 0] = new Vector2(155, 520);
            boxLocations[2, 1] = new Vector2(365, 510);
            boxLocations[2, 2] = new Vector2(570, 520);

            // confirm or deny if the location is used or not based on boolean logic algorithim
            isLocationUsed = new bool[3, 3];

            // nested double for loop that initializes all in the multi dimensional array as false for update method
            // deep logical algorithims
            for (int a = 0; a < 3; a++)
            {

                for (int b = 0; b < 3; b++)
                {
                    isLocationUsed[a, b] = false;

                }


            }
            // boolean multi dimensional array to see if x is using the spot 
            locationUsedByX = new bool[3, 3];
            for (int a = 0; a < 3; a++)
            {

                for (int b = 0; b < 3; b++)
                {
                    locationUsedByX[a, b] = false;

                }


            }
            // double nested for loop to set all values to false


            // boolean multi dimensional array to see if o is using the spot 
            locationUsedByO = new bool[3, 3];
            for (int a = 0; a < 3; a++)
            {

                for (int b = 0; b < 3; b++)
                {
                    locationUsedByO[a, b] = false;

                }


            }
            /* comment only
Locations for each field in debug mode
textfile that maps locations 
 1 2 3 
 4 5 6 
 7 8 9 
1.) x: 150 y: 100
2.) x: 370 y: 90
3.) x: 570 y: 95
4.) x: 140 y: 290
5.) x: 365 y: 300
6.) x: 575 y: 290
7.) x: 155 y: 520
8.) x: 365 y: 510
9.) x: 570 y: 520
*/



            boxCollisionRect = new Rectangle[9];

            boxCollisionRect[0] = new Rectangle((int)boxLocations[0, 0].X, (int)boxLocations[0, 0].Y, 130, 130);
            boxCollisionRect[1] = new Rectangle((int)boxLocations[0, 1].X, (int)boxLocations[0, 1].Y, 130, 130);
            boxCollisionRect[2] = new Rectangle((int)boxLocations[0, 2].X, (int)boxLocations[0, 2].Y, 130, 130);

            boxCollisionRect[3] = new Rectangle((int)boxLocations[1, 0].X, (int)boxLocations[1, 0].Y, 130, 130);
            boxCollisionRect[4] = new Rectangle((int)boxLocations[1, 1].X, (int)boxLocations[1, 1].Y, 130, 130);
            boxCollisionRect[5] = new Rectangle((int)boxLocations[1, 2].X, (int)boxLocations[1, 2].Y, 130, 130);

            boxCollisionRect[6] = new Rectangle((int)boxLocations[2, 0].X, (int)boxLocations[2, 0].Y, 130, 130);
            boxCollisionRect[7] = new Rectangle((int)boxLocations[2, 1].X, (int)boxLocations[2, 1].Y, 130, 130);
            boxCollisionRect[8] = new Rectangle((int)boxLocations[2, 2].X, (int)boxLocations[2, 2].Y, 130, 130);

            /* comment only
            Locations for each field in debug mode
            textfile that maps locations 
             1 2 3 
             4 5 6 
             7 8 9 
            1.) x: 150 y: 100
            2.) x: 370 y: 90
            3.) x: 570 y: 95
            4.) x: 140 y: 290
            5.) x: 365 y: 300
            6.) x: 575 y: 290
            7.) x: 155 y: 520
            8.) x: 365 y: 510
            9.) x: 570 y: 520
            */


           
        


        }