//public Broad(); public void StartGame(Player player1, Player player2) { player1 = new Player(true,false); player2 = new Player(false, false); }
private Point playPvB(Point pos, int row, int col, Player p1, Player p2) { bool tf = false; //tf la danh dung luat = true, sai luat || chua danh = false while (tf == false) { cell[row, col].Fill = X; p.X = row; p.Y = col; tf = true; check[row, col] = 1; do { Random ran = new Random(); Rcol = ran.Next(0, 11); Rrow = ran.Next(0, 11); } while (check[Rrow, Rcol] != 0); cell[Rrow, Rcol].Fill = O; tf = true; check[Rrow, Rcol] = 2; } return pos; }
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; }
private Point playPvP(Point pos, int row, int col, Player p1, Player p2) { bool tf = false; //tf la danh dung luat = true, sai luat || chua danh = false while (tf == false) { if (p1.GetTurn() == true && p1.GetClick() == true) { cell[row, col].Fill = X; p.X = row; p.Y = col; tf = true; player1.SetTurn(false); player2.SetTurn(true); check[row, col] = 1; } if (p2.GetTurn() == true && p2.GetClick() == true) { cell[row, col].Fill = O; tf = true; player2.SetTurn(false); player1.SetTurn(true); check[row, col] = 2; } } return pos; }