Exemple #1
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);
         }
     }
 }
Exemple #2
0
 public void KhoiDongComputer(Graphics g)
 {
     if (Stack_CacNuocDaDi.Count == 0)
     {
         DanhCo(_BanCo.SoCot / 2 * OCo._ChieuRong + 1, _BanCo.SoDong / 2 * OCo._ChieuCao + 1, g);
     }
     else
     {
         OCo oco = TimKiemNuocDi();
         DanhCo(oco.ViTri.X + 1, oco.ViTri.Y + 1, g);
     }
 }
Exemple #3
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  = DiemTC_DuyetDoc(i, j) + DiemTC_DuyetNgang(i, j) + DiemTC_DuyetCheoNguoc(i, j) + DiemTC_DuyetCheoXuoi(i, j);
                        long DiemPhongNgu = DiemPN_DuyetDoc(i, j) + DiemPN_DuyetNgang(i, j) + DiemPN_DuyetCheoNguoc(i, j) + DiemPN_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);
        }