From 87202e3d3e75d67cd826abc62d962d515614ab3b Mon Sep 17 00:00:00 2001 From: Richard Bronkhorst Date: Wed, 14 Jun 2023 21:20:47 +0200 Subject: [PATCH] Update analyzer.py and commander.py --- nullptr/analyzer.py | 5 ++++- nullptr/commander.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/nullptr/analyzer.py b/nullptr/analyzer.py index 7e53c4e..0fa0855 100644 --- a/nullptr/analyzer.py +++ b/nullptr/analyzer.py @@ -41,6 +41,7 @@ class Analyzer: def find_path(self, orig, to, depth=100, seen=set()): if depth < 1: return None if type(orig) == System: + print('start') orig = set([SearchNode(orig,None)]) print(orig) result = [n for n in orig if n.system==to] @@ -56,5 +57,7 @@ class Analyzer: system = self.store.get(System, s) if system is None: continue dest.add(SearchNode(system, o)) - if len(dest) == 0: return None + if len(dest) == 0: + print('dry') + return None return self.find_path(dest, to, depth-1, seen) diff --git a/nullptr/commander.py b/nullptr/commander.py index 191245b..87ab44b 100644 --- a/nullptr/commander.py +++ b/nullptr/commander.py @@ -85,7 +85,7 @@ class Commander(CommandLine): system = self.store.get(System, m.system()) p = self.analyzer.find_path(location, system) if p is None: continue - print(m, f'{len(p)} hops') + print(m, f'{len(p)-1} hops') def do_path(self): orig = self.ask_obj(System, 'from: ')