From 031d94fb4f900503c2eeb529d6855b7eec9e35de Mon Sep 17 00:00:00 2001 From: y5nw Date: Mon, 23 Aug 2021 14:59:31 +0200 Subject: [PATCH] (Trivial) do not continue pathfinder when the destination is reached --- tracks/path.lisp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tracks/path.lisp b/tracks/path.lisp index eb5a1bd..ac3e0d5 100644 --- a/tracks/path.lisp +++ b/tracks/path.lisp @@ -21,7 +21,7 @@ (loop with contp = t while (and (> (hash-table-count unknown) 0) contp) do (multiple-value-bind (u d) (shortest-unseen) (remhash u unknown) - (if (>= d most-positive-fixnum) + (if (or (>= d most-positive-fixnum) (equalp u to)) (setf contp nil) (loop for (v . len) in (direct-next tdb u t) for alt = (+ d len) when (< alt (gethash v dist)) do