예제 #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));
        }
예제 #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));
        }
예제 #3
0
 public MoveResult(MoveResultType type, IList <ResultCell> openedCells = null)
 {
     ResultType  = type;
     OpenedCells = openedCells;
 }
예제 #4
0
파일: Actor.cs 프로젝트: thebirk/LD47
 public MoveResult(MoveResultType type)
 {
     Type = type;
 }