From 71dbc6e37bf7e4cf1973b1141eaab3320d7f2a45 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sat, 24 Oct 2026 21:46:48 +0200 Subject: [PATCH] Light up very long dark fiber with long-haul modes and regen sites Optics past their full-rate reach now drop to a slower, longer-reaching modulation instead of refusing to fit, so fibers over 4,000 km are usable. Regeneration sites split a route into shorter optical spans for full speed, at a cost per site and per channel. The order screen warns about routes longer than any optic's full-rate reach. Closes #17 Closes #30 --- CHANGELOG.md | 6 ++++++ site/index.html | 38 ++++++++++++++++++++++++++------------ tests/issues.test.js | 23 +++++++++++++++++++++++ 3 files changed, 55 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3879726..589c3bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Very long dark fiber works now (#17, #30). Optics drop to a slower, longer- + reaching setting past their full-rate reach: the 1.6T transponder runs at + 800G to 7,000 km and 400G to 12,000 km, and ZR+ optics halve their speed + to double their reach. Regeneration sites go further: each one turns the + light back into bits and sends it on fresh, so optics only have to reach + the next site. Existing long fibers light up without changes. - "Quietest links" routing no longer flips between two paths every day. It judges how busy a link is without the customer's own traffic, splits the circuit over two paths that are about as quiet, and keeps yesterday's diff --git a/site/index.html b/site/index.html index 3288bcd..8b460c2 100644 --- a/site/index.html +++ b/site/index.html @@ -538,9 +538,9 @@ const DF_SYS={ }; const AMP_EVERY=100, AMP_COST=8000, AMP_MO=300; const OPT={ - zr4:{n:'Ackackia 400ZR+',g:400,cost:12000,reach:1500,rg:1,lvl:2,sys:'lite',blurb:'Coherent pluggable in the router. No transponder shelf.'}, - zr8:{n:'Sizzle 800ZR+',g:800,cost:22000,reach:900,rg:2,lvl:3,sys:'lite',blurb:'Twice the speed, shorter reach.'}, - tp16:{n:'Sienna WaveMagic 1.6T',g:1600,cost:70000,reach:4000,rg:2,lvl:4,sys:'roadm',blurb:'Big shelf, big reach, big invoice.'}, + zr4:{n:'Ackackia 400ZR+',g:400,cost:12000,reach:1500,modes:[[400,1500],[200,3000]],rg:1,lvl:2,sys:'lite',blurb:'Coherent pluggable in the router. No transponder shelf.'}, + zr8:{n:'Sizzle 800ZR+',g:800,cost:22000,reach:900,modes:[[800,900],[400,1800],[200,3600]],rg:2,lvl:3,sys:'lite',blurb:'Twice the speed, shorter reach.'}, + tp16:{n:'Sienna WaveMagic 1.6T',g:1600,cost:70000,reach:4000,modes:[[1600,4000],[800,7000],[400,12000]],rg:2,lvl:4,sys:'roadm',blurb:'Big shelf, big reach, big invoice.'}, }; const dfLeaseMo=km=>Math.round(400+km*1.0); const dfBuildCost=km=>Math.round(25000+km*120); @@ -563,10 +563,18 @@ const vxcMo=(km,sub,t)=>Math.round((150+km*0.12)*VXC[t].m*(sub?2:1)); const MET={prefer:{l:'Prefer',f:0.5},normal:{l:'Normal',f:1},avoid:{l:'Avoid',f:4},backup:{l:'Backup only',f:60}}; const PREF={high:'Prefer',normal:'Normal',low:'Backup only'}; const edgeKey=l=>l.a{if(l.ready>S.day||l.eqDown>S.day)return 0;const ch=l.ch||[];let g=0;for(const c of ch)g+=OPT[c].g;const f=l.chFail&&l.chFail.until>S.day?l.chFail:null;if(f){const fo=f.o&&ch.includes(f.o)?f.o:ch.slice().sort((a,b)=>OPT[a].g-OPT[b].g)[0];if(fo)g-=OPT[fo].g;}return Math.max(0,g);}; +/* Reach (#17, #30). Coherent optics trade speed for distance: past full-rate reach they drop to a + slower, more robust modulation. Regeneration sites go further: each one turns the light back into + bits and sends it on fresh, so every optical span is shorter. Each site needs a regen card per channel. */ +const REGEN_COST=30000,REGEN_MO=900,REGEN_CH=0.5,REGEN_MAX=8; +const spanKm=l=>Math.ceil(l.km/((l.regen|0)+1)); +function optMode(o,l){const O=OPT[o],km=spanKm(l);for(const [g,r] of O.modes||[[O.g,O.reach]])if(km<=r)return {g,reach:r,full:g===O.g};return null;} +const optG=(o,l)=>{const m=optMode(o,l);return m?m.g:0;}; +const regenNeed=(o,l)=>Math.max(0,Math.ceil(l.km/OPT[o].reach)-1); +const dfCap=l=>{if(l.ready>S.day||l.eqDown>S.day)return 0;const ch=l.ch||[];let g=0;for(const c of ch)g+=optG(c,l);const f=l.chFail&&l.chFail.until>S.day?l.chFail:null;if(f){const fo=f.o&&ch.includes(f.o)?f.o:ch.slice().sort((a,b)=>optG(a,l)-optG(b,l))[0];if(fo)g-=optG(fo,l);}return Math.max(0,g);}; const capOf=l=>(l.kind==='vxc'?VXC[l.vt].g:l.kind==='df'?dfCap(l):LT[l.tier].g)*(l.deg>S.day?0.5:1); const tierW=l=>{if(l.kind==='wave')return l.tier;if(l.kind==='vxc')return 0;const g=dfCap(l);return g>=6400?4:g>=1600?3:g>=400?2:g>=100?1:0;}; -const capName=l=>l.kind==='vxc'?VXC[l.vt].n:l.kind==='df'?(l.ready>S.day?'building':(l.ch||[]).length?fmtCap(dfCap(l)||(l.ch||[]).reduce((a,c)=>a+OPT[c].g,0))+' DF':'dark'):LT[l.tier].n; +const capName=l=>l.kind==='vxc'?VXC[l.vt].n:l.kind==='df'?(l.ready>S.day?'building':(l.ch||[]).length?fmtCap(dfCap(l)||(l.ch||[]).reduce((a,c)=>a+optG(c,l),0))+' DF':'dark'):LT[l.tier].n; /* ================= WORLD ================= */ // Simplified real geography: lon/lat outlines, equirectangular, with gentle "magnifying lenses" over the busy regions. @@ -1542,7 +1550,7 @@ function compute(){ // money const C=R2.cost,V=R2.rev,pm=S.priceMul; C.pops=Object.values(S.pops).reduce((a,p)=>a+POP_MO+((p.routers||1)-1)*ROUTER_MO+(p.routers||1)*RG[p.rgen||0].mo+(p.gen?GEN_MO:0),0); - C.optical=S.links.filter(l=>l.kind==='df').reduce((a,l)=>a+(l.ready>S.day?0:ampCount(l.km)*AMP_MO)+(l.spares?Math.round(150+(l.ch||[]).length*80):0),0); + C.optical=S.links.filter(l=>l.kind==='df').reduce((a,l)=>a+(l.ready>S.day?0:ampCount(l.km)*AMP_MO+(l.regen|0)*REGEN_MO)+(l.spares?Math.round(150+(l.ch||[]).length*80):0),0); C.links=S.links.reduce((a,l)=>a+(l.mo||0),0); C.nni=(S.nni||[]).reduce((a,x)=>a+NNI[x.tier].mo,0); C.transit=S.transit.reduce((a,t)=>{const q=p95(t,R2.useT[t.id]||0);R2.p95[t.id]=q;const n=t.n||1;return a+Math.max(q,PORT[t.tier].g*n*0.2)*NET[t.net].price*(t.premium&&t.city==='hkg'?NET[t.net].premium:1)*pm*regionMult(t.city)+PORT[t.tier].tmo*n;},0); @@ -1582,7 +1590,7 @@ function sanitize(s){ for(const c of Object.keys(s.pops)){const p=s.pops[c];if(!isCity(c)||!p||typeof p!=='object'){delete s.pops[c];continue;}p.routers=int(p.routers,1,RMAX,1);if(p.rgen!==undefined)p.rgen=int(p.rgen,0,RG.length-1,0);p.down=num(p.down,0);if(p.bb&&typeof p.bb==='object')p.bb.d=num(p.bb.d,0);else p.bb=null;} if(!isCity(s.home))s.home=Object.keys(s.pops)[0]||'fra'; const tier=v=>int(v,0,PORT.length-1,0),lag=v=>int(v,1,LAG_MAX,1),sid=v=>String(v==null?uid():v).slice(0,40); - s.links=s.links.filter(l=>l&&isCity(l.a)&&isCity(l.b)&&l.a!==l.b).map(l=>{l.id=sid(l.id);l.km=num(l.km,kmBetween(l.a,l.b));l.mo=num(l.mo,0);l.cut=num(l.cut,0);if(l.kind!=='df'&&l.kind!=='vxc')l.kind='wave';if(l.kind==='wave')l.tier=int(l.tier,0,LT.length-1,0);if(l.cable&&!own(CAB,l.cable))l.cable=null;if(l.kind==='vxc'&&!own(VXC,l.vt))l.vt=0;if(l.kind==='df'){if(!own(DF_SYS,l.sys))l.sys='lite';l.ch=Array.isArray(l.ch)?l.ch.filter(o=>own(OPT,o)):[];l.ready=num(l.ready,0);}if(l.metric&&!own(MET,l.metric))l.metric='normal';return l;}); + s.links=s.links.filter(l=>l&&isCity(l.a)&&isCity(l.b)&&l.a!==l.b).map(l=>{l.id=sid(l.id);l.km=num(l.km,kmBetween(l.a,l.b));l.mo=num(l.mo,0);l.cut=num(l.cut,0);if(l.kind!=='df'&&l.kind!=='vxc')l.kind='wave';if(l.kind==='wave')l.tier=int(l.tier,0,LT.length-1,0);if(l.cable&&!own(CAB,l.cable))l.cable=null;if(l.kind==='vxc'&&!own(VXC,l.vt))l.vt=0;if(l.kind==='df'){if(!own(DF_SYS,l.sys))l.sys='lite';l.ch=Array.isArray(l.ch)?l.ch.filter(o=>own(OPT,o)):[];l.ready=num(l.ready,0);l.regen=int(l.regen,0,REGEN_MAX,0);}if(l.metric&&!own(MET,l.metric))l.metric='normal';return l;}); s.transit=s.transit.filter(t=>t&&isCity(t.city)&&isNet(t.net)).map(t=>(t.site=['a','b','ab'].includes(t.site)?t.site:'a',t.id=sid(t.id),t.tier=tier(t.tier),t.n=lag(t.n),t.down=num(t.down,0),t)); s.pni=s.pni.filter(x=>x&&isCity(x.city)&&isNet(x.net)).map(x=>(x.site=['a','b','ab'].includes(x.site)?x.site:'a',x.id=sid(x.id),x.tier=tier(x.tier),x.n=lag(x.n),x)); s.caches=s.caches.filter(x=>x&&isCity(x.city)&&isNet(x.net)&&NET[x.net].cache).map(x=>(x.id=sid(x.id),x)); @@ -2219,7 +2227,10 @@ const ACT={ const l={id,a,b,kind:'df',own,sys,ch:[],km,sub:!!sc,cable:sc?sc.cid:null,mo:own?Math.round(km*0.15):dfLeaseMo(km),trench:sc?'cab:'+sc.cid:id,cut:0,day:S.day,ready:S.day+(own?dfBuildDays(km):30),spares:false}; S.links.push(l);closeModal();UI.sel={type:'link',id}; toast(own?`Groundbreaking!
Your own fiber from ${CITY[a].name} to ${CITY[b].name}. Permits and digging take about ${dfBuildDays(km)} days.`:`Dark fiber IRU signed.
${CITY[a].name}–${CITY[b].name} will be spliced and handed over in about 30 days.`,'goal');after();}, - addCh:({id,o})=>{const l=S.links.find(x=>x.id===id),O=OPT[o];if(!l||!O||l.kind!=='df')return;const why=chWhy(l,o);if(why){toast(`Can't add ${O.n}.
${esc(why)}`,'bad');sfx('err');return;}if(!portGate(l.a,1)||!portGate(l.b,1))return;if(!spend(optCost(o)))return;(l.ch=l.ch||[]).push(o);floater((CITY[l.a].x+CITY[l.b].x)/2,(CITY[l.a].y+CITY[l.b].y)/2-20,`+${O.n}`,'#FF4F9A');after();}, + regen:({id,d})=>{d=+d;const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='df'||(d!==1&&d!==-1))return;const n=(l.regen|0)+d;if(n<0||n>REGEN_MAX)return; + if(d<0&&(l.ch||[]).some(o=>!optMode(o,{km:l.km,regen:n}))){toast('Those optics need the regen site.
Remove the long-haul channels first, or keep the site.','bad');sfx('err');return;} + if(d>0&&!spend(REGEN_COST+Math.round((l.ch||[]).reduce((a,c)=>a+optCost(c),0)*REGEN_CH)))return;l.regen=n;toast(d>0?`Regen site ${n} is up.
Optical spans on ${CITY[l.a].name}–${CITY[l.b].name} are now ${spanKm(l).toLocaleString()} km.`:'Regen site removed.','good');sfx('build');after();}, + addCh:({id,o})=>{const l=S.links.find(x=>x.id===id),O=OPT[o];if(!l||!O||l.kind!=='df')return;const why=chWhy(l,o);if(why){toast(`Can't add ${O.n}.
${esc(why)}`,'bad');sfx('err');return;}if(!portGate(l.a,1)||!portGate(l.b,1))return;if(!spend(Math.round(optCost(o)*(1+REGEN_CH*(l.regen|0)))))return;(l.ch=l.ch||[]).push(o);floater((CITY[l.a].x+CITY[l.b].x)/2,(CITY[l.a].y+CITY[l.b].y)/2-20,`+${O.n}`,'#FF4F9A');after();}, rmCh:({id,o})=>{const l=S.links.find(x=>x.id===id);if(!l)return;const i=(l.ch||[]).lastIndexOf(o);if(i>=0)l.ch.splice(i,1);after();}, upSys:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||l.sys==='roadm'||lvl()<3)return;if(!spend(DF_SYS.roadm.cost))return;l.sys='roadm';if(l.ready<=S.day){l.eqDown=S.day+1;toast('Line system swap
All channels are dark for a day while the ROADMs go in.','bad');}after();}, spares:({id})=>{const l=S.links.find(x=>x.id===id);if(!l)return;l.spares=!l.spares;sfx('click');after();}, @@ -2261,7 +2272,7 @@ function pairLinks(a,b){return S.links.filter(l=>(l.a===a&&l.b===b)||(l.a===b&&l function subDfCable(a,b){return cablesOk(a,b).filter(c=>CAB[c.cid].df).sort((x,y)=>x.km-y.km)[0]||null;} function dfAllowed(a,b){if(isSub(a,b))return !!subDfCable(a,b);return cnCity(a)===cnCity(b)&&!uaePair(a,b);} function optCost(o){return Math.round(OPT[o].cost*(S&&S.ev&&S.ev.tariff>S.day?1.4:1));} -function chWhy(l,o){const O=OPT[o];if(O.lvl>lvl())return `Unlocks at customer level ${O.lvl}.`;if(O.sys==='roadm'&&l.sys!=='roadm')return 'Needs a ROADMaster 9000 line system.';if(l.km>O.reach)return `Reach is ${O.reach.toLocaleString()} km; this route is ${l.km.toLocaleString()} km.`; +function chWhy(l,o){const O=OPT[o];if(O.lvl>lvl())return `Unlocks at customer level ${O.lvl}.`;if(O.sys==='roadm'&&l.sys!=='roadm')return 'Needs a ROADMaster 9000 line system.';if(!optMode(o,l)){const mx=(O.modes||[[0,O.reach]]).at(-1)[1];return `Too far even at its slowest setting: an optical span here is ${spanKm(l).toLocaleString()} km and it reaches ${mx.toLocaleString()} km. Add a regen site (Line system).`;} if((l.ch||[]).length+soldSlots(l)>=DF_SYS[l.sys].max)return `${DF_SYS[l.sys].n} is full (${DF_SYS[l.sys].max} channels${soldSlots(l)?`, ${soldSlots(l)} sold to customers`:''}).`; for(const c of [l.a,l.b]){const p=S.pops[c];if(p&&RG[p.rgen||0].clsLatency${linkLat(l).toFixed(1)} ms one-way
${l.own?'Right-of-way upkeep':'IRU lease'}${fmt$(l.mo)}/mo
${amps} amp huts${fmt$(amps*AMP_MO)}/mo
${!bld&&!(l.ch||[]).length?`

This fiber is dark. Add optics below to carry traffic.

`:''}`; h+=`

Optics

Each channel is a pair of optics, one per end. ZR+ optics plug straight into your routers. Transponders sit on a shelf.

`; for(const k of Object.keys(OPT)){const O=OPT[k],n=(l.ch||[]).filter(x=>x===k).length,why=chWhy(l,k); - h+=`
${O.n} ${fmtG(O.g)} · reach ${O.reach.toLocaleString()} km
${esc(O.blurb)}${n?` · ${n} lit`:''}
${why?`
${esc(why)}
`:''}
${n?btn('−','rmCh',{id:l.id,o:k},'ghost sm'):''}${btn(`+ ${fmt$(optCost(k))}`,'addCh',{id:l.id,o:k},'sm',!!why||S.cash`;} - h+=`

Line system

${esc(sysD.n)}${amps} amplifiers

${esc(sysD.blurb)}

${l.sys!=='roadm'?btn(lvl()>=3?`Upgrade to ROADMaster 9000 ${fmt$(DF_SYS.roadm.cost)}`:'ROADMaster 9000 level 3','upSys',{id:l.id},'sm',lvl()<3||S.cash${fmt$(Math.round(150+(l.ch||[]).length*80))}/mo`,'spares',{id:l.id},l.spares?'green sm':'sm')}

Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.

`; + const md=optMode(k,l),cc=Math.round(optCost(k)*(1+REGEN_CH*(l.regen|0))); + h+=`
${O.n} ${(O.modes||[[O.g,O.reach]]).map(([g,r])=>fmtG(g)+' to '+r.toLocaleString()+' km').join(' · ')}
${esc(O.blurb)}${n?` · ${n} lit`:''}
${md&&!md.full?`
⚠️ Runs at ${fmtG(md.g)} per channel on this route (long-haul mode). ${regenNeed(k,l)>(l.regen|0)?`${regenNeed(k,l)} regen site${regenNeed(k,l)===1?'':'s'} would bring it back to ${fmtG(O.g)}.`:''}
`:''}${why?`
${esc(why)}
`:''}
${n?btn('−','rmCh',{id:l.id,o:k},'ghost sm'):''}${btn(`+ ${fmt$(cc)}`,'addCh',{id:l.id,o:k},'sm',!!why||S.cash`;} + const rg=l.regen|0,rgAdd=REGEN_COST+Math.round((l.ch||[]).reduce((a,c)=>a+optCost(c),0)*REGEN_CH); + h+=`

Line system

${esc(sysD.n)}${amps} amplifiers
+
Regen sites${rg?`${rg} · optical spans of ${spanKm(l).toLocaleString()} km`:'none'}

A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. ${fmt$(REGEN_MO)}/mo per site for the hut.

${rg${fmt$(rgAdd)}`,'regen',{id:l.id,d:1},'sm',S.cash

${esc(sysD.blurb)}

${l.sys!=='roadm'?btn(lvl()>=3?`Upgrade to ROADMaster 9000 ${fmt$(DF_SYS.roadm.cost)}`:'ROADMaster 9000 level 3','upSys',{id:l.id},'sm',lvl()<3||S.cash${fmt$(Math.round(150+(l.ch||[]).length*80))}/mo`,'spares',{id:l.id},l.spares?'green sm':'sm')}

Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.

`; h+=`${trafficSection(l)}${metricSection(l)}
${btn(UI.confirm===l.id?'Really give it up?':(l.own?'Abandon the fiber':'Cancel the IRU'),'rmLink',{id:l.id},'ghost sm')}
`; return h; } @@ -2769,7 +2783,7 @@ function dfModalBody(a,b,km,pop){

The glass

${btn(`Lease an IRU ${fmt$(dfLeaseMo(km))}/mo · ready in 30 days`,'dfSrc',{v:'lease'},src==='lease'?'pink':'ghost')}${sc?btn('Build your own not under the sea','dfSrc',{v:'build'},'ghost',true):btn(lvl()>=3?`Build your own ${fmt$(dfBuildCost(km))} · ~${dfBuildDays(km)} days`:'Build your own level 3','dfSrc',{v:'build'},src==='build'?'pink':'ghost',lvl()<3)}
${sc?`

A fiber pair on ${esc(CAB[sc.cid].name)}, ${sc.km.toLocaleString()} km. It shares the cable with everyone else's waves, anchors included.

`:''} ${src==='build'?`

Your own trench: almost no rent, but permits and digging take forever, and delays happen.

`:''}

Line system

${Object.keys(DF_SYS).map(k=>btn(`${DF_SYS[k].n} ${DF_SYS[k].lvl>lvl()?'level '+DF_SYS[k].lvl:fmt$(DF_SYS[k].cost)}`,'dfSys',{v:k},sys===k?'pink':'ghost',DF_SYS[k].lvl>lvl())).join('')}
-

${esc(DF_SYS[sys].blurb)} Plus ${amps} in-line amplifier${amps===1?'':'s'} (${fmt$(AMP_COST)} each, ${fmt$(AMP_MO)}/mo for hut rent and power).

+

${esc(DF_SYS[sys].blurb)} Plus ${amps} in-line amplifier${amps===1?'':'s'} (${fmt$(AMP_COST)} each, ${fmt$(AMP_MO)}/mo for hut rent and power).

${km>OPT.tp16.reach?`

${km.toLocaleString()} km is longer than any optic reaches at full speed. Transponders will run in long-haul mode (800G or 400G per channel), or add regen sites along the way to get full speed back.

`:''}
Due now${fmt$(up)}
Monthly${fmt$(mo)}/mo

For comparison, a leased 1.6T wave on this route is ${fmt$(w)}/mo. Optics come next, from the link panel.

${btn(`${src==='build'?'Start construction':'Sign the IRU'} ${fmt$(up)}`,'orderDf',{},'pink big',S.cash`; diff --git a/tests/issues.test.js b/tests/issues.test.js index 779faa1..f3e3399 100644 --- a/tests/issues.test.js +++ b/tests/issues.test.js @@ -225,3 +225,26 @@ test('#28 scenic routing stays put, and splits over two equally quiet paths', () ev("selectCity('fra');ACT.tab({t:'cust'})"); assert.deepEqual(errors, []); }); + +test('#17 #30 very long dark fiber runs in long-haul mode, and regen sites bring full speed back', () => { + const { ev, errors } = load(); + ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})"); + // a 4,500+ km terrestrial dark fiber with a ROADM, like the one in #30 + ev("ACT.buildPop({city:'mos'});S.links.push({id:'lf',a:'lis',b:'mos',kind:'df',km:4551,sys:'roadm',ch:[],ready:0,mo:1000,day:0,cut:0});ACT.buildPop({city:'lis'});S.pops.lis.rgen=3;S.pops.mos.rgen=3;compute()"); + assert.equal(ev("chWhy(S.links.find(l=>l.id==='lf'),'tp16')"), '', 'the transponder fits now'); + ev("ACT.addCh({id:'lf',o:'tp16'});compute()"); + assert.equal(ev("dfCap(S.links.find(l=>l.id==='lf'))"), 800, 'long-haul mode: 800G per channel'); + ev("ACT.regen({id:'lf',d:1});compute()"); + const l = "S.links.find(l=>l.id==='lf')"; + assert.equal(ev(`${l}.regen`), 1); + assert.equal(ev(`spanKm(${l})`), 2276); + assert.equal(ev(`dfCap(${l})`), 1600, 'one regen site: full 1.6T again'); + assert.ok(ev("R.cost.optical") >= ev("REGEN_MO"), 'regen huts cost rent'); + assert.match(ev("chWhy({km:20000,regen:0,sys:'roadm',ch:[],a:'lis',b:'mos'},'zr4')"), /regen site/, 'hopeless spans say what to do'); + // removing a regen site that optics still need is refused + ev("S.links.find(l=>l.id==='lf').km=15000;ACT.regen({id:'lf',d:-1})"); + assert.equal(ev(`${l}.regen`), 1); + ev("ACT.selLink({id:'lf'})"); + assert.match(ev("document.getElementById('panelBody').textContent"), /Regen sites/); + assert.deepEqual(errors, []); +});