public boolean pickLowestCost ( Space target , NavPath path ) { if ( target == this ) { return true ; } if ( links . size ( ) == 0 ) { return false ; } Link bestLink = null ; for ( int i = 0 ; i < getLinkCount ( ) ; i ++ ) { Link link = getLink ( i ) ; if ( ( bestLink == null ) || ( link . getTarget ( ) . getCost ( ) < bestLink . getTarget ( ) . getCost ( ) ) ) { bestLink = link ; } } path . push ( bestLink ) ; return bestLink . getTarget ( ) . pickLowestCost ( target , path ) ; }
Pick the lowest cost route from this space to another on the path