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)); }
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; }
public MoveResult(MoveResultType type) { Type = type; }