From 89ac114390846cfc34968a24b4701b60423cd090 Mon Sep 17 00:00:00 2001 From: Alfredo Beaumont Date: Sun, 30 Jan 2011 20:50:55 +0100 Subject: [PATCH] Fix comparison to avoid infinite loop with zero cost paths --- extra/path-finding/path-finding.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/path-finding/path-finding.factor b/extra/path-finding/path-finding.factor index 4b11616c20..1f6b4f5cc6 100644 --- a/extra/path-finding/path-finding.factor +++ b/extra/path-finding/path-finding.factor @@ -40,7 +40,7 @@ TUPLE: (astar) astar goal origin in-open-set open-set ; : ?set-g ( origin node astar -- ) [ cost-through ] 3keep [ swap ] 2dip - 3dup astar>> g>> at [ 1/0. ] unless* > [ 4drop ] [ set-g ] if ; + 3dup astar>> g>> at [ 1/0. ] unless* >= [ 4drop ] [ set-g ] if ; : build-path ( target astar -- path ) [ over ] [ over [ [ origin>> at ] keep ] dip ] produce 2nip reverse ; -- 2.34.1