public MaDiTuan(int kichThuoc, int dong, int cot) { this.kichThuoc = kichThuoc; dongDatMa = dong; cotDatMa = cot; a = new BanCo(this.kichThuoc); }
public MaDiTuan(int dong, int cot) { kichThuoc = 8; dongDatMa = dong; cotDatMa = cot; a = new BanCo(kichThuoc); }
public void SaoChepBanCo(ref BanCo tam) { for (int i = 0; i < banCo.GetLength(0); i++) { for (int j = 0; j < banCo.GetLength(1); j++) { tam.banCo[i, j] = banCo[i, j]; } } }
public void XuLy() { a = new BanCo(); a.DatHau(d, c, h); a.CamHau(d, c); h++; for (int i = 0; i < a.banCo.GetLength(0); i++) { int max = int.MinValue; int viTri = -1; for (int j = 0; j < a.banCo.GetLength(1); j++) { //Tao ra 1 ban co de thu BanCo tam = new BanCo(); a.SaoChepBanCo(ref tam); //Dat thu quan hau if (tam.banCo[i, j] == -1 || tam.banCo[i, j] > 0) { continue; } else { tam.DatHau(i, j, h); tam.CamHau(i, j); if (tam.TimCotCoOTrongMax(i, j, h) > max) { max = tam.TimCotCoOTrongMax(i, j, h); viTri = j; } } } if (viTri != -1) { a.DatHau(i, viTri, h); a.CamHau(i, viTri); h++; } } }