Gentler bends for links between nearby cities
The curve that dodges other cities wanted 24 map units of clearance and picked the most distant of up to 3.8x curves when nothing cleared, so short links in dense regions looped wide. Clearance now scales with link length, offsets are capped at about a third of it, and a modest curve wins over a giant one when nothing clears.
This commit is contained in:
parent
7e3ea0cefe
commit
388b12d901
3 changed files with 17 additions and 4 deletions
|
|
@ -1015,3 +1015,12 @@ test('#82 router swaps trade in the old gear, one swap a day, and requirements n
|
|||
assert.equal(ev('waveNeed(4)'), '1.6T routers');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('fiber between nearby cities bends gently instead of looping around the neighbourhood', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;for(const x of ['tor','ott','mtl','nyc','ash'])if(!S.pops[x])ACT.buildPop({city:x})");
|
||||
ev("const L=(a,b)=>{UI.via=null;UI.lmode='wave';UI.route='diverse';openLinkModal(a,b);ACT.buildLink({tier:1});closeModal();};L('tor','ott');L('ott','mtl');L('tor','nyc');L('tor','mtl');L('mtl','nyc');L('tor','ash');L('ash','nyc');GEO.clear()");
|
||||
const worst = ev("Math.max(...S.links.map(l=>{const g=linkGeom(l),A=CITY[l.a],B=CITY[l.b],L=Math.hypot(B.x-A.x,B.y-A.y);return Math.max(...g.pts.map(p=>segDist(p[0],p[1],[A.x,A.y],[B.x,B.y])))/L;}))");
|
||||
assert.ok(worst < 0.3, `worst bend is ${worst.toFixed(2)}× its length`);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue