Esempio n. 1
0
        public int GetNumberOfMines(Feld feld)
        {
            List <Feld> sur      = GetSurroundingFields(feld);
            int         numMines = 0;

            foreach (Feld element in sur)
            {
                if (element.Mine)
                {
                    numMines++;
                }
            }

            return(numMines);
        }
Esempio n. 2
0
        public SpielFeld(int h, int w, int mines)
        {
            this._height        = h;
            this._width         = w;
            this._amountOfMines = mines;

            Feld[,] spielfeld = new Feld[h, w];

            for (int i = 0; i < h; i++)
            {
                for (int j = 0; j < w; j++)
                {
                    Console.WriteLine(i + ":i j:" + j);
                    spielfeld[i, j] = new Feld(i, j);
                }
            }

            this._spielfeld = spielfeld;
        }
Esempio n. 3
0
        public List <Feld> GetSurroundingFields(Feld feld)
        {
            int xMax = feld.X + 1;
            int yMax = feld.Y + 1;
            int xMin = feld.X - 1;
            int yMin = feld.Y - 1;

            List <Feld> surroundings = new List <Feld>();

            if (yMax >= this._height)
            {
                yMax--;
            }
            if (xMax >= this._width)
            {
                yMax--;
            }
            if (yMin < 0)
            {
                yMin = 0;
            }
            if (xMin < 0)
            {
                xMin = 0;
            }

            for (int i = yMin; i < yMax; i++)
            {
                for (int j = xMin; i < xMax; j++)
                {
                    surroundings.Add(this._spielfeld[i, j]);
                }
            }



            return(surroundings);
        }
Esempio n. 4
0
 public void FelderAufdecken(Feld feld)
 {
     //ToDo
 }