required: add world resource query

This commit is contained in:
Danny Robson 2019-04-27 18:50:20 +10:00
parent b8a0da6898
commit de865f8ab8

View File

@ -5,15 +5,6 @@ import typing
import os import os
def as_graphviz(recipes: dict):
print("digraph G {")
for result, method in recipes.items():
for variation in method:
for input in variation["input"]:
print(f"{input} -> {result}")
print("}")
if __name__ == '__main__': if __name__ == '__main__':
root = os.path.dirname(__file__) root = os.path.dirname(__file__)
recipe_root = os.path.join(root, 'data', 'recipes') recipe_root = os.path.join(root, 'data', 'recipes')
@ -29,4 +20,12 @@ if __name__ == '__main__':
recipes[name] = variations recipes[name] = variations
as_graphviz(recipes)
resources = set()
for output, variations in recipes.items():
for option in variations:
if len(option['input']) == 0:
resources.add(output)
print("Resources:", resources)