public void MakeMove(Cell[,] b, Symbol s, int turnsRemaining) { Random rand = new Random(); int randRow = rand.Next(0, 5), randCol = rand.Next(0, 5); bool success = b[randRow, randCol].SetContent(s); while (!success) { randCol = rand.Next(0, 6); randRow = rand.Next(0, 6); success = b[randRow, randCol].SetContent(s); } }
//For the constructor private void SetUpCells() { board = new Cell[ROWS, COLS]; Button currentButton = null; int currentRow, currentCol; foreach (var child in UIBoard.Children) { currentButton = child as Button; if (currentButton != null) { currentButton.Click += OnCellClick; currentRow = (int)currentButton.GetValue(Grid.RowProperty); currentCol = (int)currentButton.GetValue(Grid.ColumnProperty); board[currentRow, currentCol] = new Cell(currentRow, currentCol, currentButton); } } ClearBoard(); }
public void MakeMove(Cell[,] b, Symbol s, int turnsRemaining) { }