Пример #1
0
        private OCo TimKiemNuocDi()
        {
            OCo  oCoResult = new OCo();
            long DiemMax   = 0;

            for (int i = 0; i < _BanCo.SoDong; i++)
            {
                for (int j = 0; j < _BanCo.SoCot; j++)
                {
                    if (_MangOCo[i, j].SoHuu == 0)
                    {
                        long DiemTanCong  = DiemTanCong_DuyetDoc(i, j) + DiemTanCong_DuyenNgang(i, j) + DiemTanCong_DuyetCheoNguoc(i, j) + DiemTanCong_DuyetCheoXuoi(i, j);
                        long DiemPhongNgu = DiemPhongNgu_DuyetDoc(i, j) + DiemPhongNgu_DuyenNgang(i, j) + DiemPhongNgu_DuyetCheoNguoc(i, j) + DiemPhongNgu_DuyetCheoXuoi(i, j);
                        long DiemTam      = DiemTanCong > DiemPhongNgu ? DiemTanCong : DiemPhongNgu;
                        if (DiemMax < DiemTam)
                        {
                            DiemMax   = DiemTam;
                            oCoResult = new OCo(_MangOCo[i, j].Dong, _MangOCo[i, j].Cot, _MangOCo[i, j].ViTri, _MangOCo[i, j].SoHuu);
                        }
                    }
                }
            }

            return(oCoResult);
        }
Пример #2
0
 public void KhoiTaoMangOCo()
 {
     for (int i = 0; i < _BanCo.SoDong; i++)
     {
         for (int j = 0; j < _BanCo.SoCot; j++)
         {
             _MangOCo[i, j] = new OCo(i, j, new Point(j * OCo._ChieuRong, i * OCo._ChieuCao), 0);
         }
     }
 }
Пример #3
0
 public void KhoiDongComputer(Graphics g)
 {
     if (stkCacNuocDaDi.Count == 0)
     {
         DanhCo(_BanCo.SoDong / 2 * OCo._ChieuCao + 1, _BanCo.SoCot / 2 * OCo._ChieuRong + 1, g);
     }
     else
     {
         OCo oco = TimKiemNuocDi();
         DanhCo(oco.ViTri.X + 1, oco.ViTri.Y + 1, g);
     }
 }