Fix comparison to avoid infinite loop with zero cost paths
parent
cc06c4e51f
commit
89ac114390
|
@ -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 ;
|
||||
|
|
Loading…
Reference in New Issue