Performance optimizations

This commit is contained in:
aerinon
2021-08-03 09:26:41 -06:00
parent aeb910e274
commit 24b01cfcc7
5 changed files with 64 additions and 46 deletions

View File

@@ -2120,10 +2120,11 @@ def connect_doors(world, doors, targets, player):
"""This works inplace"""
random.shuffle(doors)
random.shuffle(targets)
while doors:
door = doors.pop()
target = targets.pop()
placing = min(len(doors), len(targets))
for door, target in zip(doors, targets):
connect_entrance(world, door, target, player)
doors[:] = doors[placing:]
targets[:] = targets[placing:]
def skull_woods_shuffle(world, player):