Example #1
0
        private int CountMineAroundCell(Сell field)
        {
            var aroundCells = VisibleСells.GetAroundCellsNoTags(field, Size);
            var countMine   = 0;

            foreach (Сell acell in aroundCells)
            {
                if (Mines.IsPresent(acell))
                {
                    countMine++;
                }
            }

            return(countMine);
        }
Example #2
0
        private void AddVisibleСell(Сell field)
        {
            var countMine = CountMineAroundCell(field);

            if (countMine == 0)
            {
                VisibleСells.Add(new Сell(field.Row, field.Column));

                var aroundCells = VisibleСells.GetAroundCellsNoTags(field, Size);
                foreach (Сell acell in aroundCells)
                {
                    AddVisibleСell(acell);
                }
            }
            else
            {
                VisibleСells.Add(new CellValue(field, countMine));
            }
        }