refactor find_available_areas a bit
no semantic changes, just condensing some repeated code for clarity.wip-faster-paths
parent
ab089feb6e
commit
b95fef681f
136
Randomizer.py
136
Randomizer.py
|
@ -1624,8 +1624,8 @@ def update_requirements(graph):
|
|||
|
||||
|
||||
def find_available_areas(graph):
|
||||
check = int(StartLocation[1:2])
|
||||
AreaOpen[check] = StartLocation
|
||||
AreaOpen[int(StartLocation[1:2])] = StartLocation
|
||||
|
||||
if AreaOpen[0] == None:
|
||||
check = 'S0-32'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
|
@ -1633,94 +1633,33 @@ def find_available_areas(graph):
|
|||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[0] = check
|
||||
if AreaOpen[1] == None:
|
||||
check = 'S1-00'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
|
||||
def check_sector(area, check, tunnel1, tunnel2):
|
||||
if AreaOpen[area] == None:
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
AreaOpen[1] = check
|
||||
if ScrewAttack:
|
||||
if AreaOpen[1] == None:
|
||||
check = 'S1-6B'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
AreaOpen[area] = check
|
||||
if ScrewAttack:
|
||||
if AreaOpen[area] == None:
|
||||
path = graph.get_path(StartLocation, tunnel1)
|
||||
if path != None:
|
||||
AreaOpen[1] = check
|
||||
if AreaOpen[1] == None:
|
||||
check = 'S1-68'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
path = graph.get_path(tunnel1, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[area] = tunnel1
|
||||
if AreaOpen[area] == None:
|
||||
path = graph.get_path(StartLocation, tunnel2)
|
||||
if path != None:
|
||||
AreaOpen[1] = check
|
||||
if AreaOpen[2] == None:
|
||||
check = 'S2-00'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[2] = check
|
||||
if ScrewAttack:
|
||||
if AreaOpen[2] == None:
|
||||
check = 'S2-7F'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[2] = check
|
||||
if AreaOpen[2] == None:
|
||||
check = 'S2-82'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[2] = check
|
||||
if AreaOpen[3] == None:
|
||||
check = 'S3-00'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[3] = check
|
||||
if ScrewAttack:
|
||||
if AreaOpen[3] == None:
|
||||
check = 'S3-56'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[3] = check
|
||||
if AreaOpen[3] == None:
|
||||
check = 'S3-59'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[3] = check
|
||||
if AreaOpen[4] == None:
|
||||
check = 'S4-00'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[4] = check
|
||||
if ScrewAttack:
|
||||
if AreaOpen[4] == None:
|
||||
check = 'S4-6A'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[4] = check
|
||||
if AreaOpen[4] == None:
|
||||
check = 'S4-6C'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[4] = check
|
||||
path = graph.get_path(tunnel2, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[area] = tunnel2
|
||||
|
||||
check_sector(1, 'S1-00', 'S1-6B', 'S1-68')
|
||||
check_sector(2, 'S2-00', 'S2-7F', 'S2-82')
|
||||
check_sector(3, 'S3-00', 'S3-56', 'S3-59')
|
||||
check_sector(4, 'S4-00', 'S4-6A', 'S4-6C')
|
||||
|
||||
if AreaOpen[5] == None:
|
||||
check = 'S5-00'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
|
@ -1736,28 +1675,9 @@ def find_available_areas(graph):
|
|||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[5] = check
|
||||
if AreaOpen[6] == None:
|
||||
check = 'S6-00'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[6] = check
|
||||
if ScrewAttack:
|
||||
if AreaOpen[6] == None:
|
||||
check = 'S6-51'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[6] = check
|
||||
if AreaOpen[6] == None:
|
||||
check = 'S6-54'
|
||||
path = graph.get_path(StartLocation, check)
|
||||
if path != None:
|
||||
path = graph.get_path(check, StartLocation)
|
||||
if path != None:
|
||||
AreaOpen[6] = check
|
||||
|
||||
check_sector(6, 'S6-00', 'S6-51', 'S6-54')
|
||||
|
||||
if BlueDoors == False:
|
||||
path = graph.get_path(StartLocation, 'Security-Level-1', depth=250)
|
||||
if path != None:
|
||||
|
|
Loading…
Reference in New Issue