From 2e18e87a95e574cf37d55085f6d8cf31a79687ba Mon Sep 17 00:00:00 2001 From: Andrew Ekstedt Date: Sat, 17 Dec 2022 15:22:18 -0800 Subject: [PATCH] lib/astar: fix return value for failed search --- lib/astar.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/astar.py b/lib/astar.py index d5ab027..2c11e08 100644 --- a/lib/astar.py +++ b/lib/astar.py @@ -4,7 +4,6 @@ def search(start, is_goal, neighbors, heuristic=None): if heuristic == None: def heuristic(x): return 0 - # TODO: callable goal if not callable(is_goal): goal = is_goal def is_goal(this): @@ -44,7 +43,7 @@ def search(start, is_goal, neighbors, heuristic=None): i += 1 heappush(q, (c, i, n, this)) - return float('inf'), None + return float('inf'), None, [] def test(): data = [