1
0
Fork 0

[node] fix shortest path to only hop through refueling points

This commit is contained in:
Julien Dessaux 2024-05-05 00:08:28 +02:00
parent 063b2c9951
commit 5aac233c08
Signed by: adyxax
GPG key ID: F92E51B86E07177E
3 changed files with 26 additions and 14 deletions

View file

@ -3,12 +3,9 @@ import * as libSystems from '../lib/systems.ts';
import {
categorizeCargo,
sortByDistanceFrom,
whatCanBeTradedAt,
} from '../lib/utils.ts';
import { Ship } from '../lib/ships.ts';
import {
CargoManifest,
CommonThing,
} from '../lib/types.ts';
// example ctx { ship: {XXX}, keep: 'SILVER_ORE' }
export async function sell(ship: Ship, good: string): Promise<Ship> {
@ -54,7 +51,3 @@ export async function sell(ship: Ship, good: string): Promise<Ship> {
throw new Error(`Ship {ship.symbol} has found no importing or exchanging market for its cargo in the system`);
}
}
function whatCanBeTradedAt(cargo: CargoManifest, goods: Array<CommonThing>): Array<CommonThing> {
return goods.filter(g => cargo[g.symbol] !== undefined );
}