diff --git a/plan.py b/plan.py index 24d9afa..956c03a 100755 --- a/plan.py +++ b/plan.py @@ -120,17 +120,16 @@ def required_power(recipes: satisfactory.Cookbook, machines: Dict[str, int]) -> return total -def main(): - recipes = satisfactory.Cookbook('data/recipes') +def plan(recipes: satisfactory.Cookbook, required: Dict[str, Fraction]): + """ + Print the items and rates, machines and counts, and power requirements + need to produce the items named in the dict at the mapped rate. - # Create a list of items we want to make - # names = [ 'supercomputer' ] - names = recipes.components() - - # Create an initial name:rate request for all of the target items, then - # create a plan for their creation. - remain = [{n: basic_rate(recipes[n]['recipes'][0]) for n in names}] - rates = required_rates(recipes, remain) + :param recipes: + :param required: + :return: + """ + rates = required_rates(recipes, required) # Note if any particular item is (in aggregate) going to exceed the # highest conveyor belt capacity. @@ -146,5 +145,19 @@ def main(): print(math.ceil(power / 150), "fuel generators") +def main(): + recipes = satisfactory.Cookbook('data/recipes') + + # Create a list of items we want to make + # names = [ 'supercomputer' ] + names = recipes.components() + + # Create an initial name:rate request for all of the target items, then + # create a plan for their creation. + request = [{n: basic_rate(recipes[n]['recipes'][0]) for n in names}] + + plan(recipes, request) + + if __name__ == '__main__': main()