private IList<bool> ExploreRow(IList<bool> row, int rowIndex, Coordinates coordinates) { return row .Select((explored, columnIndex) => (coordinates.ColumnIndex == columnIndex && coordinates.RowIndex == rowIndex) || explored) .ToList(); }
private IList<IList<bool>> ExploreSquares(IList<IList<bool>> squares, Coordinates coordinates) { return squares .Select((row, rowIndex) => ExploreRow(row, rowIndex, coordinates)) .ToList(); }
public Minefield Explore(Coordinates coordinates) { return new Minefield(_width, _height, ExploreSquares(_squares, coordinates)); }