Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello, Welcome to TicTacToeGame");
            TicTacToe t = new TicTacToe();

            char[] board   = t.CreateBoard();
            char   pLetter = t.ChooseLetter();
            char   cLetter = 'X';

            if (pLetter.Equals('X'))
            {
                cLetter = 'O';
            }
            Console.WriteLine("Player's Letter = " + pLetter);
            Console.WriteLine("Computer's Letter = " + cLetter);
            t.PrintBoard(board);
            bool playVal = true;

            while (playVal)
            {
                Console.WriteLine("Choose a position among 1 to 9");
                int  choice         = Convert.ToInt32(Console.ReadLine());
                bool check_if_empty = t.check_Availability(board, choice);
                if (check_if_empty == false)
                {
                    Console.WriteLine("The position you chose is full, Please choose another position");
                }
                else
                {
                    board[choice] = pLetter;
                    t.PrintBoard(board);
                }
            }
        }