public static void DimensionMultiply <THypercube>(THypercube rangeLower, THypercube rangeUpper, Action <THypercube> action, THypercube current, int currentDimension) where THypercube : HypercubeBase { for (int i = rangeLower[currentDimension]; i <= rangeUpper[currentDimension]; i++) { current[currentDimension] = i; if (currentDimension == 0) { action(current); } else { Day17.DimensionMultiply(rangeLower, rangeUpper, action, current, currentDimension - 1); } } }
public static void DimensionMultiply <THypercube>(THypercube rangeLower, THypercube rangeUpper, Action <THypercube> action) where THypercube : HypercubeBase, new() { Day17.DimensionMultiply(rangeLower, rangeUpper, action, new THypercube(), rangeLower.Dimensions - 1); }