Beispiel #1
0
        protected MoveResult OpenCell(int x, int y)
        {
            if (Field[y, x].Mine)
            {
                return(GameOver());
            }

            List <ResultCell> openedCells = Field.OpenCell(x, y).ToList();
            MoveResultType    resultType  = CheckForVictory();

            return(new MoveResult(resultType, openedCells));
        }
Beispiel #2
0
        protected MoveResult OpenNeighbors(int x, int y)
        {
            List <ResultCell> openedCells = Field.GetNeighbors(x, y)
                                            .Where(x => !x.Flagged && !x.Oppened)
                                            .SelectMany(cell => Field.OpenCell(cell.X, cell.Y))
                                            .ToList();

            if (openedCells.Any(x => x.Mine))
            {
                return(GameOver());
            }

            MoveResultType resultType = CheckForVictory();

            return(new MoveResult(resultType, openedCells));
        }
 public MoveResult(MoveResultType type, IList <ResultCell> openedCells = null)
 {
     ResultType  = type;
     OpenedCells = openedCells;
 }
Beispiel #4
0
 public MoveResult(MoveResultType type)
 {
     Type = type;
 }