Sea routing: Suez and Panama crossings, great circles, fastest design back on par

After #133 the coastline router treated Egypt and Panama as solid land, so
Marseille–Singapore sailed round Africa (21,440 km instead of 12,175) and
Miami–Lima round Cape Horn (17,700 km for a 4,220 km hop). Real systems
cross both by land: Port Said to Suez beside the canal, and Panama
(PAN AM). These are now overland edges in the sea graph, priced as the
distance they cover. The Red Sea Crisis shuts Suez, and routes are cached
per set of open passages, also in the survey worker.

Long open-water legs follow the great circle where it stays at sea,
instead of a straight line on the map. The low-latency design may land
further off and backhaul overland, and may follow the corridor of the
fastest in-service cable on the pair when that is shorter, so it matches
Hibernia again (London–New York 25.3 ms, Halifax–London 20.9 ms) and
beats cables that take detours (Lagos–Bude 32.2 against 37.6 ms).

Tests: main's expectations restored where #133 had loosened them
(Marseille–Singapore needs no upgrades, New York–Sydney needs terminals,
express equals the fastest cable); the marine check knows the passages;
new checks for Suez, Panama, the crisis and the corridor rule.
This commit is contained in:
Frederic Jung 2026-10-26 22:13:16 +01:00
parent 656e904e05
commit 56f2d446ea
No known key found for this signature in database
5 changed files with 105 additions and 39 deletions

View file

@ -627,7 +627,7 @@ test('#67 a subsea cable can be laid between landing stations that also share a
assert.ok(ev("!!document.querySelector('#modalCard [data-act=ownCab]')"), 'the dark fiber window offers the cable');
ev("ACT.ownCab()");
assert.match(ev("document.getElementById('modalCard').textContent"), /km of seabed/);
ev("UI.seaengineering=true;ACT.orderCable()");
ev("ACT.orderCable()");
assert.ok(ev("S.links.some(l=>l.own&&l.sub&&l.a==='mrs'&&l.b==='sin')"), 'Marseille–Singapore cable ordered');
assert.deepEqual(errors, []);
});
@ -699,8 +699,8 @@ test('NOC leased lines tab prices leased dark fiber, own fiber and cables agains
const sub = JSON.parse(ev("JSON.stringify(leaseSwaps().find(x=>x.sub))"));
assert.equal(sub.why, '');
assert.ok(sub.opts.find(o => o.k === 'cab').up > ev("ownCabCost(ownCabKm('lon','nyc'))"));
ev("for(const c of ['cai','pmo'])ACT.buildPop({city:c});for(const c in S.pops)S.pops[c].rgen=2;UI.via=null;openLinkModal('cai','pmo');ACT.buildLink({tier:2});closeModal();compute()");
const ms = JSON.parse(ev("JSON.stringify(leaseSwaps().find(x=>x.a==='cai'&&x.b==='pmo'))"));
ev("for(const c of ['mrs','sin'])ACT.buildPop({city:c});for(const c in S.pops)S.pops[c].rgen=2;UI.via=null;openLinkModal('mrs','sin');ACT.buildLink({tier:2});closeModal();compute()");
const ms = JSON.parse(ev("JSON.stringify(leaseSwaps().find(x=>x.a==='mrs'&&x.b==='sin'))"));
assert.ok(ms && ms.opts.some(o => o.k === 'cab'), 'landing stations on one landmass can swap a wave for your own cable (#67)');
ev("ACT.leaseSwap({a:'ams',b:'fra',src:'lease'})");
assert.equal(ev("document.getElementById('dash').hidden"), true);
@ -1058,10 +1058,10 @@ test('#104 declining a loan offer clears the bank badge while paused', () => {
test('#88 no subsea cable longer than any optic can light, and a refund for calling one off', () => {
const { ev, errors } = load();
ev("ACT.start({});S.cash=1e10;S.lvl=13;S.won=true;for(const g of GOALS)S.done[g.id]=0");
// New York to Sydney is too long for plain optics; the marine route needs optical engineering, so the order screen asks
// New York to Sydney is too long for plain optics; since #78 premium terminals light it, so the order screen asks
// for them instead of refusing. Only a length beyond even both upgrades is refused.
assert.equal(ev("ownCabWhy('nyc','syd')"), '');
assert.deepEqual(JSON.parse(ev("JSON.stringify(subNeed(ownCabKm('nyc','syd')))")), ['engineering']);
assert.deepEqual(JSON.parse(ev("JSON.stringify(subNeed(ownCabKm('nyc','syd')))")), ['terminal']);
assert.equal(ev('subNeed(26000)'), null, 'nothing lights 26,000 km');
assert.equal(ev("ownCabWhy('lax','syd')"), '', 'Los Angeles to Sydney still works');
assert.ok(ev("subCarrier(ownCabKm('lax','syd'))") > 0);