Update analyzer.py
This commit is contained in:
parent
87202e3d3e
commit
e9815cfca8
@ -38,12 +38,12 @@ class Analyzer:
|
|||||||
return next(gates, None)
|
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 depth < 1: return None
|
||||||
|
if seen is None:
|
||||||
|
seen = set()
|
||||||
if type(orig) == System:
|
if type(orig) == System:
|
||||||
print('start')
|
|
||||||
orig = set([SearchNode(orig,None)])
|
orig = set([SearchNode(orig,None)])
|
||||||
print(orig)
|
|
||||||
result = [n for n in orig if n.system==to]
|
result = [n for n in orig if n.system==to]
|
||||||
if len(result) > 0:
|
if len(result) > 0:
|
||||||
return result[0].path()
|
return result[0].path()
|
||||||
@ -58,6 +58,5 @@ class Analyzer:
|
|||||||
if system is None: continue
|
if system is None: continue
|
||||||
dest.add(SearchNode(system, o))
|
dest.add(SearchNode(system, o))
|
||||||
if len(dest) == 0:
|
if len(dest) == 0:
|
||||||
print('dry')
|
|
||||||
return None
|
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