diff --git a/CHANGELOG.md b/CHANGELOG.md index ee68ffc..8c1cd4b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Networks you reach through an exchange's route server now stay "via RS" (#265). With an Open peering policy, the peering desk used to turn some of them into separate sessions of their own. - The Build POP button now shows the whole price of a new POP, including the routers of your standard POP (#261). Before, it showed only the site, although the standard routers were paid for on top; a note under the button now lists them, and the intern's one-tap template prices them in as well. POPs that come with a new wave, dark fiber, your own subsea cable or a consortium seat now get the standard routers too, and those offers show the price with them. ## [2.5.0] — 2026-11-02 diff --git a/site/scenarios/weekly/2026-W44.json b/site/scenarios/weekly/2026-W44.json index 730bb3d..f43ff92 100644 --- a/site/scenarios/weekly/2026-W44.json +++ b/site/scenarios/weekly/2026-W44.json @@ -1 +1 @@ -{"v":1,"key":"2026-W44","rev":2,"theme":"flood","city":"sto","cash":2050000,"days":250,"lvl":4,"rules":{"ddos":true},"mods":[],"goal":{"t":"floods","p":{"n":32,"big":5}},"name":{"l":"wkscn.name_packet_monsoon","p":{}},"desc":{"l":"wkscn.desc_city_hosts_the_internets_favourite","p":{"city":"sto"}},"seed":1559294845,"par":214,"ref":{"home":"sto","bb":true,"ix":true,"steps":[{"k":"hop","v":["sto","tll",1,null]},{"k":"hop","v":["tll","hel",1,null]}],"avoid":[],"tr2":false,"scrub":2}} +{"v":1,"key":"2026-W44","rev":3,"theme":"flood","city":"sto","cash":2050000,"days":250,"lvl":4,"rules":{"ddos":true},"mods":[],"goal":{"t":"floods","p":{"n":28,"big":5}},"name":{"l":"wkscn.name_packet_monsoon","p":{}},"desc":{"l":"wkscn.desc_city_hosts_the_internets_favourite","p":{"city":"sto"}},"seed":1559294845,"par":198,"ref":{"home":"sto","bb":true,"ix":true,"steps":[{"k":"hop","v":["sto","tll",1,null]},{"k":"hop","v":["tll","hel",1,null]}],"avoid":[],"tr2":false,"scrub":2}} diff --git a/src/game/70-rules/40-peering-desk.js b/src/game/70-rules/40-peering-desk.js index e8369bd..6ada987 100644 --- a/src/game/70-rules/40-peering-desk.js +++ b/src/game/70-rules/40-peering-desk.js @@ -17,6 +17,8 @@ function peeringDeskDay(d){const w=Math.floor(d/7);let D=S.pdesk; if(!ixs.length||Math.random()>=Math.min(0.9,0.15*ixs.length)*PDESK_ASK[p])return; const c=pick(ixs),real=ixMembers(c).filter(id=>{const n=NET[id];return !S.peers[id+'@'+c]&&!merged(id)&&n.type!=='t1'&&n.type!=='cdn'&&n.pol!=='paid'&&n.share<=0.006;}); const net=real.length&&Math.random()<0.4?pick(real):null,fresh=Math.random()>=0.6; + // A network you already reach (route server, your own exchange) needs no session of its own (#265). + if(net&&ixSessions(c).has(net))return; if(!pdeskWant(p,net,fresh)){D.d++;return;} if(net)S.peers[net+'@'+c]=true;D.a++;if(!D.ix.includes(c)&&D.ix.length { + const { ev, errors } = load(); + ev("ACT.start({});S.cash=1e9;S.lvl=6;S.nextFail=S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});ACT.buildPop({city:'ams'});S.pops.ams.rgen=3;ACT.buyIx({city:'ams',tier:1});ACT.rs({city:'ams'});compute()"); + assert.equal(ev('ppol()'), 'open'); + const viaRs = JSON.parse(ev("JSON.stringify(ixMembers('ams').filter(id=>NET[id].pol==='open'&&ixSessions('ams').has(id)&&!S.peers[id+'@ams']))")); + assert.ok(viaRs.length > 0, 'some networks are reached through the route server'); + // Every day: someone asks, at this IX, a real network, each candidate in turn, fresh PeeringDB. + for (let i = 0; i < 60; i++) { + ev(`(()=>{const q=[0.01,0.01,0.01,${i / 60},0.9];Math.random=()=>q.length?q.shift():0.5;})()`); + ev(`peeringDeskDay(S.day+${i})`); + } + const made = JSON.parse(ev(`JSON.stringify(${JSON.stringify(viaRs)}.filter(id=>S.peers[id+'@ams']))`)); + assert.deepEqual(made, [], 'route-server networks stay "via RS"'); + const bilateral = JSON.parse(ev("JSON.stringify(Object.keys(S.peers).filter(k=>k.endsWith('@ams')))")); + assert.ok(bilateral.length > 0, 'networks the route server does not reach still get their own sessions'); + assert.deepEqual(errors, []); +}); diff --git a/tests/scenarios-playtest.test.js b/tests/scenarios-playtest.test.js index 000515f..a35ae05 100644 --- a/tests/scenarios-playtest.test.js +++ b/tests/scenarios-playtest.test.js @@ -41,8 +41,9 @@ const PLAY = { // The 1.6T chains: grow the traffic first, then light every hop at once (a day-0 build also gets there, just). pac: { ref: [...home('hnl'), ...home('lax'), ...home('syd'), ['link', 'lax', 'tok', 1, 'jup'], HIRE, ['served', 145], ['link', 'lax', 'hnl', 4, 'seaus'], ['link', 'hnl', 'suv', 4, 'scx'], ['link', 'suv', 'syd', 4, 'scx']], win: [50, 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: [40, 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 }, + 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 }, }; test('C1 played: every scenario has a reference strategy and a shortcut that fails', () => {