diff --git a/site/scenarios/weekly/2026-W44.json b/site/scenarios/weekly/2026-W44.json index f43ff92..ce0ba22 100644 --- a/site/scenarios/weekly/2026-W44.json +++ b/site/scenarios/weekly/2026-W44.json @@ -1 +1 @@ -{"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}} +{"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":185,"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/30-networks/45-home-markets.js b/src/game/30-networks/45-home-markets.js index 15be11a..2ba0f77 100644 --- a/src/game/30-networks/45-home-markets.js +++ b/src/game/30-networks/45-home-markets.js @@ -24,3 +24,7 @@ function locSh(T,c){let m=LOC_SH.get(T);if(!m)LOC_SH.set(T,m=new Map());let a=m. for(let j=0;j0){const f=g/gw;for(let j=0;j!(S&&(S.mode==='puzzle'||S.pz||S.ar||S.scn)); +function cityShares(T,c){if(locOn())return locSh(T,c);let a=LOC_PLAIN.get(T);if(!a)LOC_PLAIN.set(T,a=Float64Array.from(NETS,n=>T[n.id]||0));return a;} diff --git a/src/game/70-rules/95-utilities.js b/src/game/70-rules/95-utilities.js index fa11190..165d8cd 100644 --- a/src/game/70-rules/95-utilities.js +++ b/src/game/70-rules/95-utilities.js @@ -14,12 +14,13 @@ function utilityCacheMoves(city){if(!S||!S.pops[city])return [];const groups=new // list of networks, and Goggle is throttled to half in Russia. The world shares (NSH) would size boxes for networks the // city cannot even reach, and too few for the ones it uses most. const cityShTab=c=>cnCity(c)?NSH_CN:ruCity(c)?NSH_RU:CITY[c].kr&&S.krExit?NSH_KRX:NSH; -const cityNetSh=(c,id)=>{const j=LOC_NIX.get(id);return (j===undefined?0:locSh(cityShTab(c),c)[j])*(id==='ggl'&&ruCity(c)?0.5:1);}; -// A city's total share only depends on its table and on the Russian throttle, and the tables never change after load: -// summed once per kind of city, not once per network asked about (that was cities × networks² every shift). -const CSH_SUM=new Map(); -function cityShSum(c){const T=cityShTab(c),k=ruCity(c)?1:0;let m=CSH_SUM.get(T);if(!m)CSH_SUM.set(T,m=[null,null]); - if(m[k]===null){let t=0;for(const id in T)t+=cityNetSh(c,id);m[k]=t;}return m[k];} +const cityNetSh=(c,id)=>{const j=LOC_NIX.get(id);return (j===undefined?0:cityShares(cityShTab(c),c)[j])*(id==='ggl'&&ruCity(c)?0.5:1);}; +// A city's total share only depends on its split (its table, localised for the city, #48) and on the Russian throttle, +// and those never change after load: summed once per split, not once per network asked about (that was cities × +// networks² every shift). +const CSH_SUM=new WeakMap(); +function cityShSum(c){const a=cityShares(cityShTab(c),c),k=ruCity(c)?1:0;let m=CSH_SUM.get(a);if(!m)CSH_SUM.set(a,m=[null,null]); + if(m[k]===null){const T=cityShTab(c);let t=0;for(const id in T)t+=cityNetSh(c,id);m[k]=t;}return m[k];} function cacheDem(c,id){const t=cityShSum(c);return t>0?((R.cityDem&&R.cityDem[c])||0)*cityNetSh(c,id)/t:0;} // One box per site first, if the city sends the network anything at all; then more boxes while that demand outgrows them // (100G each, #248). diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js index c0b34bb..b2429ef 100644 --- a/src/game/80-simulation/30-compute.js +++ b/src/game/80-simulation/30-compute.js @@ -103,7 +103,7 @@ function compute(){RW.gen++; // traffic you failed to deliver, and it does not cross your links only to be thrown away. const ru=ruCity(c),thr=n=>n==='ggl'&&ru?0.5:1;let sa=shArr.get(SH),sm=shSum.get(SH);if(!sa){shArr.set(SH,sa=NETS.map(n=>SH[n.id]||0));shSum.set(SH,sm=[]);} // This city's own split: its traffic to networks that sell to homes goes mostly to the ones whose users are near (#48). - const ls=locSh(SH,c); + const ls=cityShares(SH,c); const tt=sm[+ru]||(sm[+ru]=[NETS.reduce((t,n,j)=>t+sa[j]*thr(n.id),0),NETS.reduce((t,n,j)=>t+sa[j],0)]),lf=loc?NETS.reduce((t,n,j)=>t+(R2.reachable[n.id]?ls[j]*thr(n.id):0),0)/(tt[0]||1):1,d=d0*tt[0]/(tt[1]||1)*lf; R2.cityEye[c]=eye;R2.cityDem[c]=d;R2.citySrv[c]=0;R2.demand+=d; for(let j=0;j{__ot++;return ot(...a);};"); let found = false; - for (let d = 0; d < 20 && !found; d++) { + // Played until such a trial comes: on the big save that is day 51 (where each city's traffic goes decides which + // offers pass, #48). + for (let d = 0; d < 60 && !found; d++) { p.ev('rwDay()'); for (let k = 0; k < 400 && p.ev('!!RW.job'); k++) { if (p.ev('__later.length')) { p.ev('__later.shift()()'); continue; } diff --git a/tests/direct-egress.test.js b/tests/direct-egress.test.js index cb448c5..1dc4dc3 100644 --- a/tests/direct-egress.test.js +++ b/tests/direct-egress.test.js @@ -27,7 +27,8 @@ function twoPops() { } test('at its own POP a carrier\'s port takes the traffic bound for that carrier, not an even split', () => { - const { ev, lvl, tly, errors } = newYork(); + // Both ports with room: New York's traffic to the US eyeballs in Level Tree's cone alone would fill its port (#48). + const { ev, lvl, tly, errors } = newYork(1, 150); assert.ok(via(ev, lvl, 'lvl') > 1, 'Level Tree traffic goes out of the Level Tree port'); assert.equal(via(ev, tly, 'lvl'), 0, 'and none of it out of Tell-Ya'); assert.ok(via(ev, tly, 'tly') > 1 && via(ev, lvl, 'tly') === 0, 'the same for Tell-Ya');