Update analyzer.py
This commit is contained in:
parent
87202e3d3e
commit
e9815cfca8
@ -38,12 +38,12 @@ class Analyzer:
|
||||
return next(gates, None)
|
||||
|
||||
|
||||
def find_path(self, orig, to, depth=100, seen=set()):
|
||||
def find_path(self, orig, to, depth=100, seen=None):
|
||||
if depth < 1: return None
|
||||
if seen is None:
|
||||
seen = set()
|
||||
if type(orig) == System:
|
||||
print('start')
|
||||
orig = set([SearchNode(orig,None)])
|
||||
print(orig)
|
||||
result = [n for n in orig if n.system==to]
|
||||
if len(result) > 0:
|
||||
return result[0].path()
|
||||
@ -52,12 +52,11 @@ class Analyzer:
|
||||
jg = self.get_jumpgate(o.system)
|
||||
if jg is None: continue
|
||||
for s in jg.systems:
|
||||
if s in seen: continue
|
||||
if s in seen: continue
|
||||
seen.add(s)
|
||||
system = self.store.get(System, s)
|
||||
if system is None: continue
|
||||
dest.add(SearchNode(system, o))
|
||||
if len(dest) == 0:
|
||||
print('dry')
|
||||
return None
|
||||
return self.find_path(dest, to, depth-1, seen)
|
||||
return self.find_path(dest, to, depth-1, seen)
|
||||
|
Loading…
Reference in New Issue
Block a user