Exemple #1
0
 public void ExpandReveal(int x, int y)
 {
     for (int x_position = Math.Max(0, x - 1); x_position < Math.Min(x + 2, mapSize); x_position++)
     {
         for (int y_position = Math.Max(0, y - 1); y_position < Math.Min(y + 2, mapSize); y_position++)
         {
             MineSquare mineSquare = mineSquares.Where(ms => ms.X == x_position && ms.Y == y_position).FirstOrDefault();
             if (mineSquare != null && !mineSquare.IsMine)
             {
                 mineSquare.Reveal();
             }
         }
     }
 }
Exemple #2
0
 public void DrawMineField()
 {
     mineSquares.Clear();
     foreach (int x in Enumerable.Range(0, mapSize))
     {
         foreach (int y in Enumerable.Range(0, mapSize))
         {
             MineSquare square = new MineSquare()
             {
                 X = x,
                 Y = y,
             };
             mineSquares.Add(square);
         }
     }
 }