private void ButtonPress(int i, int j) { if (array[i, j] == 0) { Write.Play(); Draw(turn, i, j); array[i, j] = TicTac.SetValue(turn); NextTurn(); } }
private void Normal() { if (turnCount > 0) { if (TicTac.CheckAlmost(array, out x, out y) == true) { Draw(turn, x, y); array[x, y] = TicTac.SetValue(turn); NextTurn(); } else { RandomMove(); } } }
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(); } }