diff --git a/RecipeGenerator.cs b/RecipeGenerator.cs --- a/RecipeGenerator.cs +++ b/RecipeGenerator.cs @@ -189,6 +189,14 @@ namespace DesertPaintLab costSortedReagents.Sort(new ReagentCostSort()); } + // Generate paint recipes. + // minConcentration - the minimum permitted concentration in a recipe (10 for paint, 50 for ribbons) + // maxConcentration - the maximum concentrataion for a recipe + // minReagents - the minimum number of ingredients in a recipe + // maxReagents - the maximum number of ingredients allowed in a recipe + // fullQuantityDepth - at this depth of ingredient or below, allow up to fullQuantity of any reagent + // fullQuantity - the maximum amount of any reagent to permit up to the full quantity depth. After that, reagents are limited by the + // per-reagent value public void BeginRecipeGeneration(uint minConcentration, uint maxConcentration, uint minReagents, uint maxReagents, uint fullQuantityDepth, uint fullQuantity) { if (running) @@ -492,7 +500,9 @@ namespace DesertPaintLab { if (Mode == SearchType.DEPTH_FIRST) { - uint targetQuantity = (node.ReagentCount <= FullQuantityDepth) ? ((uint)node.ReagentCount * FullQuantity) : node.MaxConcentration + 1; + uint targetQuantity = (node.ReagentCount <= FullQuantityDepth) + ? ((uint)node.ReagentCount * FullQuantity) + : node.MaxConcentration + 1; do { --targetQuantity; node.InitForQuantity(targetQuantity); @@ -509,19 +519,18 @@ namespace DesertPaintLab else { // breadth-first search - uint targetQuantity = MinConcentration-1; - uint quantityLimit = (node.ReagentCount <= FullQuantityDepth) ? (FullQuantity * (uint)node.ReagentCount) : node.MaxConcentration; + uint targetQuantity = MinConcentration - 1; + uint quantityLimit = (node.ReagentCount <= FullQuantityDepth) + ? (FullQuantity * (uint)node.ReagentCount) + : node.MaxConcentration; do { ++targetQuantity; node.InitForQuantity(targetQuantity); - } while ((targetQuantity <= quantityLimit) && (node.CurrentTargetQuantity != node.UsedQuantity)); + } while ((targetQuantity < quantityLimit) && (node.CurrentTargetQuantity != node.UsedQuantity)); while ((ok = IterateBreadthFirst(node)) && !requestCancel) { - if (Progress != null) - { - Progress(this, null); - } + Progress?.Invoke(this, null); } } if (ok)