Ejemplo n.º 1
0
        public IEnumerable <Choice> GetChoices(IMineGame mineGame, MineDetector mineDetector)
        {
            var l = mineGame.AllCells()
                    .Where(c => !mineDetector.IsSureAMine(c) && mineGame.NeighboursMineCountAt(c) == null).ToList();
            var cellCoordinate = l[_random.Next(l.Count)];

            return(new[] { new Choice(cellCoordinate, 1) });
        }
Ejemplo n.º 2
0
 public IEnumerable <Choice> GetChoices(IMineGame mineGame, MineDetector mineDetector)
 {
     return(GetCandidates(mineGame)
            .Where(c => mineGame.NeighboursMineCountAt(c) == null && !mineDetector.IsSureAMine(c))
            .Select(c => new Choice(c, 0.1)).ToList());
 }
Ejemplo n.º 3
0
 private static IEnumerable <Choice> FindSafePlace(IMineGame mineGame, MineDetector mineDetector)
 {
     foreach (var point in mineGame.AllCells())
     {
         var neighbours  = mineGame.GetNeighbours(point).ToList();
         var minesCount1 = neighbours.Count(mineDetector.IsSureAMine);
         var minesCount2 = mineGame.NeighboursMineCountAt(point);
         if (minesCount1 == minesCount2)
         {
             foreach (var coordinate in neighbours.Where(
                          p => mineGame.NeighboursMineCountAt(p) == null && !mineDetector.IsSureAMine(p)))
             {
                 yield return(new Choice(coordinate, 0));
             }
         }
     }
 }