Пример #1
0
 private void RandomMove()
 {
     if (turnCount > 0)
     {
         r      = new Random();
         button = r.Next(1, 9);
         TicTac.ButtonToArray(button, out x, out y);
         while (array[x, y] != 0)
         {
             button = r.Next(1, 9);
             TicTac.ButtonToArray(button, out x, out y);
         }
         Draw(turn, x, y);
         array[x, y] = TicTac.SetValue(turn);
         NextTurn();
     }
 }
Пример #2
0
 private void Impossible()
 {
     if (turnCount > 0)
     {
         if (TicTac.CheckAlmost(array, out x, out y) == true)
         {
             ButtonPress(x, y);
         }
         else
         {
             if (TicTac.CheckTrap(array, turnCount, out button) == true)
             {
                 TicTac.ButtonToArray(button, out x, out y);
                 ButtonPress(x, y);
             }
             else
             {
                 if (array[1, 1] == 0)
                 {
                     ButtonPress(1, 1);
                 }
                 else
                 {
                     button = TicTac.RandomCorner(array);
                     if (button != 0)
                     {
                         TicTac.ButtonToArray(button, out x, out y);
                         ButtonPress(x, y);
                     }
                     else
                     {
                         RandomMove();
                     }
                 }
             }
         }
     }
 }