Esempio n. 1
0
        public MineGameCache(IMineGame subject)
        {
            _subject = subject;

            ColumnCount = subject.ColumnCount;
            LineCount   = subject.LineCount;

            _cache = new MineArray <int?>(LineCount, ColumnCount);
        }
Esempio n. 2
0
 public MineDetector(IMineGame mineGame)
 {
     _mines = new MineArray <bool>(mineGame.LineCount, mineGame.ColumnCount);
     foreach (var point in mineGame.AllCells())
     {
         var undigedNeighbours = mineGame.GetNeighbours(point)
                                 .Where(p => mineGame.NeighboursMineCountAt(p) == null).ToList();
         if (undigedNeighbours.Count == mineGame.NeighboursMineCountAt(point))
         {
             foreach (var undigedNeighbour in undigedNeighbours)
             {
                 _mines[undigedNeighbour] = true;
             }
         }
     }
 }