Esempio n. 1
0
 public void EmptyBox(MineBox Box, MineBox[] MBox)
 {
     int i = Box.TabIndex;
     Box.Fnum(ReturnNum(Box));
     OpenBox++;
     if (i % X != X - 1)
     {
         if (ReturnNum(MBox[i + 1]) == 0 && MBox[i + 1].Enabled == true)
         {
             EmptyBox(MBox[i + 1], MBox);
         }
         else if (MBox[i + 1].Enabled == true)
         {
             MBox[i + 1].Fnum(ReturnNum(MBox[i + 1]));
             OpenBox++;
         }
     }
     if (i + X < X * Y)
     {
         if (ReturnNum(MBox[i + X]) == 0 && MBox[i + X].Enabled == true)
             EmptyBox(MBox[i + X], MBox);
         else if (MBox[i + X].Enabled == true)
         {
             MBox[i + X].Fnum(ReturnNum(MBox[i + X]));
             OpenBox++;
         }
     }
     if (i % X != 0)
     {
         if (ReturnNum(MBox[i - 1]) == 0 && MBox[i - 1].Enabled == true)
             EmptyBox(MBox[i - 1], MBox);
         else if (MBox[i - 1].Enabled == true)
         {
             MBox[i - 1].Fnum(ReturnNum(MBox[i - 1]));
             OpenBox++;
         }
     }
     if (i - X >= 0)
     {
         if (ReturnNum(MBox[i - X]) == 0 && MBox[i - X].Enabled == true)
             EmptyBox(MBox[i - X], MBox);
         else if (MBox[i - X].Enabled == true)
         {
             MBox[i - X].Fnum(ReturnNum(MBox[i - X]));
             OpenBox++;
         }
     }
     if (i % X != X - 1 && i + X + 1 < X * Y)
     {
         if (ReturnNum(MBox[i + X + 1]) == 0 && MBox[i + X + 1].Enabled == true)
             EmptyBox(MBox[i + X + 1], MBox);
         else if (MBox[i + X + 1].Enabled == true)
         {
             MBox[i + X + 1].Fnum(ReturnNum(MBox[i + X + 1]));
             OpenBox++;
         }
     }
     if (i % X != 0 && i - X - 1 >= 0)
     {
         if (ReturnNum(MBox[i - X - 1]) == 0 && MBox[i - X - 1].Enabled == true)
             EmptyBox(MBox[i - X - 1], MBox);
         else if (MBox[i - X - 1].Enabled == true)
         {
             MBox[i - X - 1].Fnum(ReturnNum(MBox[i - X - 1]));
             OpenBox++;
         }
     }
     if (i % X != X - 1 && i - X + 1 >= 0)
     {
         if (ReturnNum(MBox[i - X + 1]) == 0 && MBox[i - X + 1].Enabled == true)
             EmptyBox(MBox[i - X + 1], MBox);
         else if (MBox[i - X + 1].Enabled == true)
         {
             MBox[i - X + 1].Fnum(ReturnNum(MBox[i - X + 1]));
             OpenBox++;
         }
     }
     if (i % X != 0 && i + X - 1 < X * Y)
     {
         if (ReturnNum(MBox[i + X - 1]) == 0 && MBox[i + X - 1].Enabled == true)
             EmptyBox(MBox[i + X - 1], MBox);
         else if (MBox[i + X - 1].Enabled == true)
         {
             MBox[i + X - 1].Fnum(ReturnNum(MBox[i + X - 1]));
             OpenBox++;
         }
     }
 }
Esempio n. 2
0
 public int Bum(MineBox Box, MineBox[] MBox)
 {
     int i = Box.TabIndex;
     if (Flags[i] != 1)
         if (ReturnNum(Box) == 9)
         {
             Box.Fmine(true);
             return 1;           // взрыв
         }
         else if (ReturnNum(Box) == 0)
         {
             EmptyBox(Box, MBox);   //пустая ячейка
             return 0;
         }
         else
         {
             Box.Fnum(ReturnNum(Box));    //ячейка с числом
             OpenBox++;
             return 0;
         }
     return 0;
 }