Factorio: align tech tree sections in growing ingredient requirements

This commit is contained in:
Fabian Dill 2021-04-10 18:45:11 +02:00
parent 50f06c3aac
commit 6d15aef88a
4 changed files with 7 additions and 3 deletions

View File

@ -27,6 +27,7 @@ class MultiWorld():
class AttributeProxy(): class AttributeProxy():
def __init__(self, rule): def __init__(self, rule):
self.rule = rule self.rule = rule
def __getitem__(self, player) -> bool: def __getitem__(self, player) -> bool:
return self.rule(player) return self.rule(player)

View File

@ -13,7 +13,7 @@ with open(source_file) as f:
with open(recipe_source_file) as f: with open(recipe_source_file) as f:
raw_recipes = json.load(f) raw_recipes = json.load(f)
tech_table = {} tech_table = {}
technology_table = {} technology_table:Dict[str, Technology] = {}
always = lambda state: True always = lambda state: True

View File

@ -43,8 +43,11 @@ def get_shapes(world: MultiWorld, player: int) -> Dict[str, List[str]]:
tech_names.sort() tech_names.sort()
world.random.shuffle(tech_names) world.random.shuffle(tech_names)
while len(tech_names) > 4: while len(tech_names) > 4:
diamond_0, diamond_1, diamond_2, diamond_3 = tech_names[:4] slice = tech_names[:4]
tech_names = tech_names[4:] tech_names = tech_names[4:]
slice.sort(key=lambda tech_name: len(technology_table[tech_name].ingredients))
diamond_0, diamond_1, diamond_2, diamond_3 = slice
# 0 | # 0 |
# 1 2 | # 1 2 |
# 3 V # 3 V