public void OpenCell(Сell field) { if (Status == GameStatus.Play) { if (field.Status == CellStatus.Mark) { Marks.AddClick(field); } else if (!Mines.IsPresent(field)) { AddVisibleСell(field); if (VisibleСells.IsCompleted(Size, CountMines)) { Status = GameStatus.Victory; VisibleMarkMine(); VisibleСells.Add(Mines); } } else { Status = GameStatus.GameOver; VisibleСells.Add(new CellExplosion(field)); VisibleMarkMine(); VisibleСells.Add(Mines); } } }
private void VisibleMarkMine() { var markMineList = new ListСell(); foreach (Сell fieldIntersection in ListСell.Intersection(Marks, Mines)) { markMineList.Add(new CellMine(fieldIntersection, true)); } VisibleСells.Add(markMineList); }
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)); } }