public void InitializeBoard(Board br) { int row, col; cell = new Rectangle[MCOL, MROW]; check = new int[MCOL, MROW]; for (row = 0; row < MROW; row++) for (col = 0; col < MCOL; col++) { check[row, col] = 0; cell[row, col] = new Rectangle(); if ((row % 2 == 1 && col % 2 == 0) || (row % 2 == 0 && col % 2 == 1)) { cell[row, col].Fill = System.Windows.Media.Brushes.Blue; //cell[row, col].StrokeThickness = 5; Grid.SetColumn(cell[row, col], col); Grid.SetRow(cell[row, col], row); } else //if ((row % 2 == 0 && col % 2 == 1) || (row % 2 == 1 && col % 2 == 0)) { cell[row, col].Fill = System.Windows.Media.Brushes.White; //cell[row, col].StrokeThickness = 5; Grid.SetColumn(cell[row, col], col); Grid.SetRow(cell[row, col], row); } GridBC.Children.Add(cell[row, col]); } }
private void PvB_btn_Click(object sender, RoutedEventArgs e) { Board br = new Board(); player1 = new Player(true, false); player2 = new Player(false, true); Uri uX = new Uri(@"../../Image/X.png", UriKind.Relative); Uri uO = new Uri(@"../../Image/O.png", UriKind.Relative); X.ImageSource = new BitmapImage(uX); O.ImageSource = new BitmapImage(uO); state = 2; }