コード例 #1
0
 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);
     }
 }
コード例 #2
0
        //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();
        }
コード例 #3
0
 public void MakeMove(Cell[,] b, Symbol s, int turnsRemaining)
 {
 }