Update analyzer.py

This commit is contained in:
Richard Bronkhorst 2023-06-14 21:26:46 +02:00
parent 87202e3d3e
commit e9815cfca8

View File

@ -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()
@ -58,6 +58,5 @@ class Analyzer:
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)