protected void Pieceboard_Click(object sender, Point diem) { if (click && thaotac.nguoi) { click = false; var x = (int)(diem.X / 30); var y = (int)(diem.Y / 30); if ((diem.X % 30 > 10 && diem.X % 30 < 20) || diem.Y % 30 > 10 && diem.Y % 30 < 20) { SendNotification(Thongbao.vitrikhongdung); return; } if (diem.Y % 30 > 20) { y++; } if (diem.X % 30 > 20) { x++; } var quanmoi = new Quanco { X = x, Y = y, kieu = (laquanX ? Kieuquan.QuanX : Kieuquan.QuanO) }; kiemtra.Chenquanco(quanmoi); } //Chenquancotoiban(quanmoi); }
private void Chenquancotoiban(Quanco piece) { var point = new Point(piece.X * 30 - 9, piece.Y * 30 - 9); piece.Hinhdang.SetValue(Canvas.LeftProperty, point.X); piece.Hinhdang.SetValue(Canvas.TopProperty, point.Y); PieceboardComponent.PieceContainer.Children.Add(piece.Hinhdang); laquanX = piece.kieu != Kieuquan.QuanX; PieceboardComponent.CursorContainer.Children.Remove(quancohientai); Ganquancochochuot(); SendNotification(Thongbao.kiemtra_nguoithang, piece); }
public void Maychoi() { int m = 0, n = 0; int err = 0; int[,] banco = new int[Khaibaobien.dodai, Khaibaobien.dodai]; for (int i = 0; i < 15; i++) { for (int j = 0; j < 15; j++) { if (kiemtra.quan[i, j] == null) { banco[i, j] = -1; } else { banco[i, j] = kiemtra.quan[i, j].kieu == Kieuquan.QuanX ? 0 : 1; } } } do { AI.GetInstance().Danh(banco); m = AI.GetInstance().X; n = AI.GetInstance().Y; err++; if (err > 100) { SendNotification(Thongbao.batdaugame); return; } } while (Luatchoi.Exit(m, n, banco)); Quanco q = new Quanco(); q.X = m; q.Y = n; q.kieu = (laquanX ? Kieuquan.QuanX : Kieuquan.QuanO); kiemtra.Chenquanco(q); }