From 92ef1e8c2e549c4c10c77fbc29adc917f46c3e4d Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 20 May 2024 22:52:14 +0200 Subject: Fixed pathing function for probes --- nodejs/lib/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/nodejs/lib/utils.ts b/nodejs/lib/utils.ts index ec3ab09..24aa3b4 100644 --- a/nodejs/lib/utils.ts +++ b/nodejs/lib/utils.ts @@ -64,6 +64,7 @@ type Step = {waypoint: Waypoint, prev: string, fuel: number, total: number}; type ShortestPath = Array<{symbol: string, fuel: number}>; export async function shortestPath(origin: Waypoint, destination: Waypoint, range: number, waypoints: Array): Promise { + if (range === 0) range = Infinity; let backtrace: {[key: string]: Step} = {}; let fuels: {[key: string]: number} = {}; // fuel = distance + 1 per hop let unvisited: {[key: string]: Waypoint} = {}; -- cgit v1.2.3