Exemplo n.º 1
0
        public static void AI()
        {
            AI_Mode othello = new AI_Mode();

            othello.newBoard();
            while (!othello.Allfilled())
            {
                othello.Oturn();
                if (othello.hasQueryO)
                {
                    othello.hasQueryO = false;
                    othello.Xturn_AI();
                    if (othello.hasQueryX)
                    {
                        othello.hasQueryX = false;
                    }
                    else
                    {
                        break;
                    }
                }
                else
                {
                    othello.Xturn_AI();
                    if (othello.hasQueryX)
                    {
                        othello.hasQueryX = false;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.Clear();
            Console.SetCursorPosition(Console.WindowWidth / 2 - 4, Console.WindowHeight / 2 - 5);
            if (othello.scoreO > othello.scoreX)
            {
                Console.Write("O WIN");
            }
            else if (othello.scoreO < othello.scoreX)
            {
                Console.Write("X WIN");
            }
            else
            {
                Console.Write("DRAW");
            }
            Console.SetCursorPosition(Console.WindowWidth / 2 - 18, Console.WindowHeight / 2 - 3);
            Console.Write("PRESS ENTER TO SEE THE BOARD..!!!");
            Console.ReadKey();
            Console.Clear();
            othello.PrintBoard();
            Console.ReadKey();
        }
Exemplo n.º 2
0
 public static void AI()
 {
     AI_Mode othello = new AI_Mode();
     othello.newBoard();
     while (!othello.Allfilled())
     {
         othello.Oturn();
         if (othello.hasQueryO)
         {
             othello.hasQueryO = false;
             othello.Xturn_AI();
             if (othello.hasQueryX)
                 othello.hasQueryX = false;
             else
                 break;
         }
         else
         {
             othello.Xturn_AI();
             if (othello.hasQueryX)
                 othello.hasQueryX = false;
             else
                 break;
         }
     }
     Console.Clear();
     Console.SetCursorPosition(Console.WindowWidth / 2 - 4, Console.WindowHeight / 2 - 5);
     if (othello.scoreO > othello.scoreX)
         Console.Write("O WIN");
     else if (othello.scoreO < othello.scoreX)
         Console.Write("X WIN");
     else
         Console.Write("DRAW");
     Console.SetCursorPosition(Console.WindowWidth / 2 - 18, Console.WindowHeight / 2 - 3);
     Console.Write("PRESS ENTER TO SEE THE BOARD..!!!");
     Console.ReadKey();
     Console.Clear();
     othello.PrintBoard();
     Console.ReadKey();
 }