public static IEnumerable <SlicePattern> GetAllPossible(int minCells, int maxCells) { for (int rows = 0; rows <= maxCells; rows++) { for (int columns = 0; columns <= maxCells; columns++) { var pattern = new SlicePattern(); pattern.Right = columns; pattern.Down = rows; var cellCount = pattern.CellCount(); if (minCells <= cellCount && cellCount <= maxCells) { yield return(pattern); //if (pattern.Right != pattern.Down) //{ // // Create flipped pattern // var flippedPattern = new SlicePattern(); // flippedPattern.Down = pattern.Right; // flippedPattern.Right = pattern.Down; // yield return flippedPattern; //} } } } }
public int Cells() { return(Pattern.CellCount()); }