예제 #1
0
 private static Covers UncoverDeep(
     this Covers covers,
     MineField mineField,
     Point point)
 {
     if (!covers.IsCovered(point))
     {
         return(covers);
     }
     if (!mineField.IsEmptyAt(point))
     {
         return(covers.Uncover(point));
     }
     return(point
            .Neighbours(mineField.Size)
            .Aggregate(
                covers.Uncover(point),
                (current, neighbor) => current.UncoverDeep(mineField, neighbor)));
 }
예제 #2
0
        public GameState Do(Covers covers)
        {
            var moves = _moves.Push(covers);

            return(new GameState(moves, CursorPosition));
        }
예제 #3
0
 public static GameState Start(MineField mineField)
 {
     return(GameState.Create(Covers.Create(mineField.Size)));
 }
예제 #4
0
 public static GameState Create(Covers covers)
 {
     return(new GameState(ImmutableStack.Create(covers), new Point(0, 0)));
 }