feat(world): add Bilbao and land the Biscay cables there
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5b24282224
commit
e23a0e2c90
15 changed files with 91 additions and 15 deletions
66
tests/bilbao-landing.test.js
Normal file
66
tests/bilbao-landing.test.js
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
const start = "ACT.start({});S.cash=1e9;S.nextFail=1e9;S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0";
|
||||
|
||||
test('Bilbao is on the map, on land and ready to take a POP; it has no exchange of its own', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
assert.equal(ev("CITY.bio.name"), 'Bilbao');
|
||||
assert.equal(ev("CITY.bio.cc"), 'ES');
|
||||
assert.equal(ev("CITY.bio.land"), 'eu');
|
||||
assert.equal(ev("onLand(CITY.bio.x,CITY.bio.y)"), true);
|
||||
assert.equal(ev("!!CITY.bio.ix"), false, 'the exchange is in Madrid');
|
||||
assert.ok(ev("kmBetween('bio','mad')") > 250 && ev("kmBetween('bio','mad')") < 450);
|
||||
assert.equal(ev("isSub('bio','mad')"), false, 'reached overland from Madrid');
|
||||
assert.equal(ev("typeof CITY.sdr"), 'undefined', 'no Santander');
|
||||
ev("ACT.buildPop({city:'mad'});ACT.buildPop({city:'bio'})");
|
||||
assert.equal(ev("!!S.pops.bio"), true);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('every transatlantic cable that came ashore on the Biscay coast lands at Bilbao', () => {
|
||||
const { ev, errors } = load();
|
||||
ev("ACT.start({})");
|
||||
const lands = id => JSON.parse(ev(`JSON.stringify(CABLES.find(c=>c.id==='${id}').pairs.map(p=>p.slice(0,2)))`));
|
||||
assert.deepEqual(lands('marea'), [['ash', 'bio']]);
|
||||
assert.deepEqual(lands('grace'), [['nyc', 'lon'], ['nyc', 'bio']]);
|
||||
assert.ok(lands('sol').some(p => p.join() === 'pdl,bio'));
|
||||
assert.ok(lands('col3').some(p => p.join() === 'mia,bio'));
|
||||
for (const [id, a, b] of [['marea', 'ash', 'bio'], ['grace', 'nyc', 'bio'], ['sol', 'pdl', 'bio'], ['col3', 'mia', 'bio']]) {
|
||||
assert.equal(ev(`cablesFor('${a}','${b}').map(c=>c.cid).includes('${id}')`), true, `${id} lands at Bilbao`);
|
||||
}
|
||||
for (const id of ['marea', 'grace', 'sol', 'col3']) {
|
||||
assert.equal(ev(`CABLE_PAIRS.some(p=>p.cid==='${id}'&&(p.a==='mad'||p.b==='mad'))`), false, `${id} no longer ends at Madrid`);
|
||||
}
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('transit and peers in Bilbao: the big carriers, Drizzle Electric and Tangerine Telecom; old saves still load', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
for (const n of ['lvl', 'cog', 'skl', 'drz', 'tng']) assert.equal(ev(`NET.${n}.pops.includes('bio')`), true, `${n} is in Bilbao`);
|
||||
assert.equal(ev("CITY_PDB.bio.join()"), '1,8,1341', 'PeeringDB: one facility, eight networks');
|
||||
ev("ACT.buildPop({city:'bio'})");
|
||||
for (const n of ['drz', 'tng']) {
|
||||
ev(`ACT.buyTransit({city:'bio',net:'${n}',tier:1})`);
|
||||
assert.equal(ev(`S.transit.some(t=>t.city==='bio'&&t.net==='${n}')`), true, `${n} sells transit in Bilbao`);
|
||||
}
|
||||
// A save from before: a Marea link between Ashburn and Madrid.
|
||||
ev("ACT.buildPop({city:'ash'});ACT.buildPop({city:'mad'})");
|
||||
const save = JSON.parse(ev("JSON.stringify(Object.assign(JSON.parse(JSON.stringify(S)),{links:[{id:'old1',a:'ash',b:'mad',kind:'wave',tier:2,km:6500,mo:100,cut:0,sub:true,cable:'marea',ready:0}]}))"));
|
||||
const out = JSON.parse(ev(`JSON.stringify(sanitize(JSON.parse(${JSON.stringify(JSON.stringify(save))})).links.map(l=>[l.a,l.b,l.cable]))`));
|
||||
assert.deepEqual(out, [['ash', 'mad', null]], 'the link survives as a plain subsea link');
|
||||
for (const z of [0.35, 1.4, 6]) ev(`cam.z=${z};draw(performance.now())`);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('Marea leaves the American coast at Virginia Beach, not New Jersey, so its line does not cross the northeast', () => {
|
||||
const { ev, errors } = load();
|
||||
ev(start);
|
||||
const pts = JSON.parse(ev("JSON.stringify(CABLES.find(c=>c.id==='marea').pairs[0][2])"));
|
||||
assert.deepEqual(pts[0], [-75.7, 36.85], 'the first waypoint is off Virginia Beach');
|
||||
assert.ok(pts.every(([lo, la]) => ev(`(()=>{const p=proj(${lo},${la});return !onLand(p[0],p[1])})()`)), 'every waypoint is at sea');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
@ -795,8 +795,8 @@ test('Atlantic islands and Halifax: real landings, real exchanges only, and isla
|
|||
assert.equal(ev(`NETS.filter(n=>n.type!=='t1'&&n.pops.some(c=>${JSON.stringify(isl)}.includes(c))&&!(n.up||[]).some(u=>NET[u].type==='t1')&&!n.pops.some(c=>!${JSON.stringify(isl)}.includes(c))).map(n=>n.id).join()`), '');
|
||||
const hop = (path) => ev(`Math.min(...${JSON.stringify(path)}.slice(1).map((c,i)=>Math.max(...cablesFor(${JSON.stringify(path)}[i],c).map(p=>subCarrier(p.km)))))`);
|
||||
const direct = (a, b) => ev(`Math.max(...cablesFor('${a}','${b}').map(p=>subCarrier(p.km)))`);
|
||||
assert.equal(direct('mia', 'mad'), 1200);
|
||||
assert.equal(hop(['mia', 'bda', 'pdl', 'mad']), 1600, 'Florida to Spain via Bermuda and the Azores');
|
||||
assert.equal(direct('mia', 'bio'), 1200);
|
||||
assert.equal(hop(['mia', 'bda', 'pdl', 'bio']), 1600, 'Florida to Spain via Bermuda and the Azores');
|
||||
assert.equal(hop(['mia', 'pdl', 'lis']), 1600, 'Florida to Lisbon via the Azores');
|
||||
assert.equal(direct('atn', 'lis'), 1200);
|
||||
assert.equal(hop(['atn', 'bda', 'lis']), 1600);
|
||||
|
|
@ -819,9 +819,9 @@ test('Atlantic islands and Halifax: real landings, real exchanges only, and isla
|
|||
assert.ok(ev('!!S.pops.pdl') && ev('S.lvl') >= 4);
|
||||
assert.equal(ev('scnProg().items.length'), 3);
|
||||
assert.equal(ev("fastPath('mia','mad',1600)"), false);
|
||||
ev("S.cash=1e9;for(const c of ['mia','bda','mad','lis','tci','lag']){ACT.buildPop({city:c});S.pops[c].rgen=3;}S.pops.pdl.rgen=3;");
|
||||
ev("S.cash=1e9;for(const c of ['mia','bda','mad','bio','lis','tci','lag']){ACT.buildPop({city:c});S.pops[c].rgen=3;}S.pops.pdl.rgen=3;");
|
||||
const wave = (a, b, via) => ev(`UI.via='${via}';UI.route='same';openLinkModal('${a}','${b}');ACT.buildLink({tier:4});closeModal();S.links.length`);
|
||||
wave('mia', 'bda', 'sol'); wave('bda', 'pdl', 'sol'); wave('pdl', 'mad', 'sol'); wave('lis', 'tci', 'ace'); wave('tci', 'lag', 'twoaf');
|
||||
wave('mia', 'bda', 'sol'); wave('bda', 'pdl', 'sol'); wave('pdl', 'bio', 'sol'); wave('bio', 'mad', null); wave('lis', 'tci', 'ace'); wave('tci', 'lag', 'twoaf');
|
||||
ev('compute()');
|
||||
assert.equal(ev("fastPath('mia','mad',1600)"), true);
|
||||
assert.equal(ev("fastPath('lis','lag',1600)"), true);
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ const PLAY = {
|
|||
// When the 150 Gbps arrive swings with the world's customers (day 66, then 33, as Africa's capitals joined), so the floor sits below it.
|
||||
win: [25, 120], cheese: [...home('hnl'), ...home('lax'), ...home('syd'), ['link', 'lax', 'tok', 1, 'jup'], ['link', 'lax', 'syd', 3, 'hwk'], ['loans']], by: null },
|
||||
// The win day swings with the seed (34 to 58 over five seeds in 2.5.0), so the floor sits below that spread.
|
||||
atl: { ref: [['bb', 'pdl'], ['tr', 'pdl', 1], ...home('mia'), ...home('mad'), ...home('lis'), HIRE, ['link', 'mia', 'bda', 4, 'sol'], ['link', 'bda', 'pdl', 4, 'sol'], ['link', 'pdl', 'mad', 4, 'sol'], ['served', 90], ['link', 'lis', 'tci', 4, 'ace'], ['link', 'tci', 'lag', 4, 'twoaf'], ['bb', 'lag']],
|
||||
win: [30, 120], cheese: [['bb', 'pdl'], ['tr', 'pdl', 1], ...home('mia'), ...home('mad'), ...home('lis'), ['link', 'mia', 'mad', 3, 'col3'], ['link', 'lis', 'lag', 3, 'equi'], ['loans']], by: null },
|
||||
atl: { ref: [['bb', 'pdl'], ['tr', 'pdl', 1], ...home('mia'), ...home('mad'), ...home('lis'), HIRE, ['link', 'mia', 'bda', 4, 'sol'], ['link', 'bda', 'pdl', 4, 'sol'], ['pop', 'bio'], ['link', 'pdl', 'bio', 4, 'sol'], ['link', 'bio', 'mad', 4], ['served', 90], ['link', 'lis', 'tci', 4, 'ace'], ['link', 'tci', 'lag', 4, 'twoaf'], ['bb', 'lag']],
|
||||
win: [30, 120], cheese: [['bb', 'pdl'], ['tr', 'pdl', 1], ...home('mia'), ...home('mad'), ...home('lis'), ['pop', 'bio'], ['link', 'mia', 'bio', 3, 'col3'], ['link', 'lis', 'lag', 3, 'equi'], ['loans']], by: null },
|
||||
};
|
||||
|
||||
test('C1 played: every scenario has a reference strategy and a shortcut that fails', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue