Fix comparison to avoid infinite loop with zero cost paths

db4
Alfredo Beaumont 2011-01-30 20:50:55 +01:00
parent cc06c4e51f
commit 89ac114390
1 changed files with 1 additions and 1 deletions

View File

@ -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 ;