Interns: the same orders, each best at one part of the job
The three interns run every order the same way at the same salary; each is now better at one thing, and says so when hired: - Anycast Annie peers: the IX order runs every day, not only weekly, and the PNI order twice a week. - Kevin from the night shift does maintenance: two line system swaps a night instead of one, and never a fat finger. He rolls the same dice (catching it before Enter), so a seeded game plays the same whoever is hired. - Tracy Route plans ahead: the transit, ports, routers, optics and optical transport orders act as if traffic were already 10% higher (OPS_AHEAD).
This commit is contained in:
parent
c96f9e7644
commit
ed0cac9974
13 changed files with 133 additions and 18 deletions
|
|
@ -7,6 +7,7 @@ All notable changes to this project are documented here. The project follows
|
|||
## [Unreleased]
|
||||
|
||||
- Whoever runs sales can now answer renewal haggles for you, each in their own way: switch it on at the sales desk. The engineer keeps nerdy customers at the market price and gives everyone else their discount, the shark refuses discounts and some customers walk, and the CEO settles it on the golf course, for better or worse.
|
||||
- The three interns now each have something they are best at: Anycast Annie peers every day and orders PNIs twice a week, Kevin from the night shift swaps two line systems a night and never fat-fingers anything, and Tracy Route buys capacity as if traffic were already 10% higher. They run the same orders at the same salary.
|
||||
- Your intern can upgrade optical transport: a new standing order moves full, busy fiber to a bigger line system, or trades its smallest channels for bigger optics. Pick a line system, and every fiber on a smaller one is moved up to it. A line system swap takes the fiber down for a day, so the intern only does it where the traffic gets around it and no customer rides it, one a night.
|
||||
- Your intern can standardize your routers on a model you choose: pick it in Keep routers ahead, and every POP on a smaller model is swapped to it, the busiest first, within the monthly budget. Every setting in the Standing orders sheet is now a list to pick from instead of a button to tap through.
|
||||
- France gets seven more cities: Lyon, Toulouse, Lille, Bordeaux, Strasbourg, Rennes and Nantes, all but Nantes with an exchange of their own (#288). SF-Error Telecom and Boy-Egg Telecom bring home broadband and mobile, Ov-Hatch Cloud and Scale-Away bring French clouds, Tangerine Telecom and Free as in Beer reach the new cities, Cogentle reaches Toulouse, Lille, Bordeaux and Strasbourg, and Andorable Telecom comes up to Toulouse. The Atlantic cables now come ashore where they really do: Ami-Tea at Bordeaux and Dunno-ant at Nantes, and Dunno-ant starts at Virginia Beach.
|
||||
|
|
|
|||
|
|
@ -3213,6 +3213,9 @@
|
|||
"ops.fire":"Entlassen",
|
||||
"ops.fired":"{name} hat den Ausweis abgegeben und den guten Tacker mitgenommen. Deine Daueraufträge ruhen.",
|
||||
"ops.floor":"Mindestens behalten",
|
||||
"ops.good_annie":"Am besten beim Peering: geht die Exchanges jeden Tag durch statt wöchentlich und bestellt zweimal pro Woche PNIs.",
|
||||
"ops.good_kevin":"Am besten bei Wartung: zwei Line-System-Tausche pro Nacht statt einem, und nie ein dicker Finger.",
|
||||
"ops.good_tracy":"Am besten im Vorausplanen: kauft Transit, Ports, Router und Optiken, als wäre der Traffic schon 10 % höher.",
|
||||
"ops.hire_an_intern":"NOC-Praktikant einstellen",
|
||||
"ops.hire_mo":"Einstellen · {price}/Monat",
|
||||
"ops.hire_pitch_short":"Regeln einmal festlegen, und ein Praktikant klickt jeden Tag die Buttons.",
|
||||
|
|
|
|||
|
|
@ -3211,6 +3211,9 @@
|
|||
"ops.fire":"Despedir",
|
||||
"ops.fired":"{name} devolvió la tarjeta y se llevó la grapadora buena. Tus órdenes permanentes quedan en pausa.",
|
||||
"ops.floor":"Conservar al menos",
|
||||
"ops.good_annie":"La mejor en peering: repasa los exchanges cada día, no cada semana, y pide PNI dos veces por semana.",
|
||||
"ops.good_kevin":"El mejor en mantenimiento: dos cambios de sistema de línea por noche en vez de uno, y nunca un dedazo.",
|
||||
"ops.good_tracy":"La mejor planificando: compra tránsito, puertos, routers y ópticas como si el tráfico ya fuera un 10 % mayor.",
|
||||
"ops.hire_an_intern":"Contratar a un becario del NOC",
|
||||
"ops.hire_mo":"Contratar · {price}/mes",
|
||||
"ops.hire_pitch_short":"Fija las reglas una vez y un becario pulsa los botones cada día.",
|
||||
|
|
|
|||
|
|
@ -3211,6 +3211,9 @@
|
|||
"ops.fire":"Remercier",
|
||||
"ops.fired":"{name} a rendu son badge et emporté la bonne agrafeuse. Tes ordres permanents sont en pause.",
|
||||
"ops.floor":"Garder au moins",
|
||||
"ops.good_annie":"La meilleure en peering : passe les exchanges en revue chaque jour, pas chaque semaine, et commande des PNI deux fois par semaine.",
|
||||
"ops.good_kevin":"Le meilleur en maintenance : deux changements de système de ligne par nuit au lieu d’un, et jamais une faute de frappe.",
|
||||
"ops.good_tracy":"La meilleure pour anticiper : achète transit, ports, routeurs et optiques comme si le trafic était déjà 10 % plus haut.",
|
||||
"ops.hire_an_intern":"Recruter un stagiaire NOC",
|
||||
"ops.hire_mo":"Recruter · {price}/mois",
|
||||
"ops.hire_pitch_short":"Fixe les règles une fois, un stagiaire clique sur les boutons chaque jour.",
|
||||
|
|
|
|||
|
|
@ -3211,6 +3211,9 @@
|
|||
"ops.fire":"Licenzia",
|
||||
"ops.fired":"{name} ha restituito il badge e si è preso la spillatrice buona. I tuoi ordini permanenti sono in pausa.",
|
||||
"ops.floor":"Tieni almeno",
|
||||
"ops.good_annie":"La migliore nel peering: passa gli exchange ogni giorno, non ogni settimana, e ordina PNI due volte a settimana.",
|
||||
"ops.good_kevin":"Il migliore nella manutenzione: due cambi di line system per notte invece di uno, e mai un errore di battitura.",
|
||||
"ops.good_tracy":"La migliore a pianificare: compra transito, porte, router e ottiche come se il traffico fosse già più alto del 10%.",
|
||||
"ops.hire_an_intern":"Assumi uno stagista NOC",
|
||||
"ops.hire_mo":"Assumi · {price}/mese",
|
||||
"ops.hire_pitch_short":"Fissa le regole una volta, e uno stagista clicca i pulsanti ogni giorno.",
|
||||
|
|
|
|||
|
|
@ -3211,6 +3211,9 @@
|
|||
"ops.fire":"Dispensar",
|
||||
"ops.fired":"{name} devolveu o crachá e levou o grampeador bom. Suas ordens permanentes estão em pausa.",
|
||||
"ops.floor":"Manter pelo menos",
|
||||
"ops.good_annie":"A melhor em peering: passa pelos exchanges todo dia, não toda semana, e pede PNIs duas vezes por semana.",
|
||||
"ops.good_kevin":"O melhor em manutenção: duas trocas de sistema de linha por noite em vez de uma, e nunca um dedo gordo.",
|
||||
"ops.good_tracy":"A melhor em planejar: compra trânsito, portas, roteadores e ópticas como se o tráfego já estivesse 10% maior.",
|
||||
"ops.hire_an_intern":"Contratar um estagiário de NOC",
|
||||
"ops.hire_mo":"Contratar · {price}/mês",
|
||||
"ops.hire_pitch_short":"Defina as regras uma vez, e um estagiário clica nos botões todo dia.",
|
||||
|
|
|
|||
|
|
@ -3,11 +3,15 @@
|
|||
would (ACT.*, pniPlace, the #185/#192 planners), so it costs exactly what the click costs, with toasts and redraws
|
||||
muted and one recompute at the end. Without an intern nothing here runs and no random numbers are drawn. */
|
||||
const INTERN_MO=6000,OPS_LOG=12,OPS_CAPS=[10000,50000,250000,1e6,5e6,0],OPS_CAPS_MO=[1000,2500,5000,10000,25000,0],OPS_FLOORS=[0,50000,250000,1e6,5e6];
|
||||
// Every intern runs every order, the same way and at the same price; each is better at one part of the job (g: what).
|
||||
// Annie peers: the IX order every day, the PNI order twice a week. Kevin does maintenance: two line systems a night,
|
||||
// and never a fat finger. Tracy plans ahead: the capacity orders act as if traffic were OPS_AHEAD higher already.
|
||||
const INTERNS={
|
||||
annie:{i:'📡',n:N_('ops.anycast_annie'),s:N_('ops.annie'),d:N_('ops.annie_d')},
|
||||
kevin:{i:'🌙',n:N_('ops.kevin_from_the_night_shift'),s:N_('ops.kevin'),d:N_('ops.kevin_d')},
|
||||
tracy:{i:'🧭',n:N_('ops.tracy_route'),s:N_('ops.tracy'),d:N_('ops.tracy_d')},
|
||||
annie:{i:'📡',n:N_('ops.anycast_annie'),s:N_('ops.annie'),d:N_('ops.annie_d'),g:N_('ops.good_annie')},
|
||||
kevin:{i:'🌙',n:N_('ops.kevin_from_the_night_shift'),s:N_('ops.kevin'),d:N_('ops.kevin_d'),g:N_('ops.good_kevin')},
|
||||
tracy:{i:'🧭',n:N_('ops.tracy_route'),s:N_('ops.tracy'),d:N_('ops.tracy_d'),g:N_('ops.good_tracy')},
|
||||
};
|
||||
const OPS_AHEAD=1.1,opsIs=id=>!!S&&!!S.ops&&S.ops.intern===id,opsAhead=()=>opsIs('tracy')?OPS_AHEAD:1;
|
||||
// Deals are not the intern's: the sales desk signs them (39-sales-auto.js).
|
||||
// The orders, in the order the panel shows them. pop: can be switched off per POP. cap: default monthly budget, of setup
|
||||
// fees, or (mo) of the running costs the order adds, for caches, which are free to rack but cost rent every month.
|
||||
|
|
@ -139,7 +143,7 @@ const opsProv=c=>{const pv=opsP('transit','prov'),n=isNet(pv)?NET[pv]:null;retur
|
|||
const OPS_RUN={
|
||||
repair(X){purgeInc();for(const i of S.inc.slice())if(i.type!=='ddos'&&i.until>S.day&&i.cost>0&&!(i.slow&&i.rushed)&&X.can('repair',i.cost)&&X.pay('repair',()=>ACT.fixInc({id:i.id})))X.did('repair');},
|
||||
routers(X){const at=opsP('routers','at')/100,how=opsP('routers','how'),m=opsP('routers','model'),fix=m!=='next',
|
||||
load=c=>Math.max((R.nodeLoad[c]||0)/(R.nodeCap[c]||nodeCap(c)||1),portsUsed(c)/Math.max(1,portsMax(c)));
|
||||
load=c=>Math.max((R.nodeLoad[c]||0)*opsAhead()/(R.nodeCap[c]||nodeCap(c)||1),portsUsed(c)/Math.max(1,portsMax(c)));
|
||||
// A chosen model: swap every POP still on a smaller one to it, the busiest first, while the budget lasts. Never a
|
||||
// step down, never a model that is not unlocked or does not fit, and only with a second router or no traffic there.
|
||||
if(fix&&rgOpen(m))for(const c of opsPops('routers').sort((a,b)=>load(b)-load(a))){const p=S.pops[c],g=p.rgen||0;
|
||||
|
|
@ -158,7 +162,7 @@ const OPS_RUN={
|
|||
transit(X){if(scnRule('noTransit'))return;const N=opsP('transit','x');
|
||||
for(const c of opsPops('transit')){let ts=S.transit.filter(t=>t.city===c);if(!ts.length)continue;
|
||||
// Thirty days of 95th-percentile-ish history per port; their peaks summed is a safe (high) estimate of the POP's peak.
|
||||
const peak=ts.reduce((a,t)=>a+(t.hist||[]).reduce((m,v)=>Math.max(m,v),0),0);if(!(peak>0))continue;
|
||||
const peak=ts.reduce((a,t)=>a+(t.hist||[]).reduce((m,v)=>Math.max(m,v),0),0)*opsAhead();if(!(peak>0))continue;
|
||||
// "Already connected" (#227): only the providers you buy from here, the smallest first, never a new contract.
|
||||
const have=opsP('transit','prov')==='have',n=have?null:opsProv(c);if(!have&&!n)continue;
|
||||
const grow=t=>{const k=t.n||1,up=t.tier+1;
|
||||
|
|
@ -181,12 +185,12 @@ const OPS_RUN={
|
|||
// Router ports that pending PNI augments will take when they land are spoken for.
|
||||
resv=c=>S.pni.reduce((a,p)=>p.up&&p.city===c?a+Math.max(0,PORT_SLOT(p.up.tier)*(p.up.n||1)-PORT_SLOT(p.tier)*(p.n||1)):a,0),room=c=>portsMax(c)-portsUsed(c)+1e-9-resv(c);
|
||||
// Each port: cap() now, use today, lag() and ups() the jobs it could have as {cost, cap after, w for the log, go}, sig() to see a job took.
|
||||
for(const p of S.pni){const c=p.city,use=R.usePni[p.id]||0,cap=()=>lagCap(pniG(p),p.n),n=()=>p.n||1;if(!pniOn(p)||p.up||!(use>0)||cap()>=N*use||!opsHere('ports',c))continue;
|
||||
for(const p of S.pni){const c=p.city,use=(R.usePni[p.id]||0)*opsAhead(),cap=()=>lagCap(pniG(p),p.n),n=()=>p.n||1;if(!pniOn(p)||p.up||!(use>0)||cap()>=N*use||!opsHere('ports',c))continue;
|
||||
L.push({city:c,at:c,use,u:use/cap(),cap,n,rt:(S.pops[c]||{}).routers||1,busy:()=>!!p.up,sig:()=>[p.tier,n(),!!p.g1,!!p.up].join(),
|
||||
lag:()=>n()<LAG_MAX&&!msfNope(p.net,c)&&PORT_SLOT(p.tier)<=room(c)?{cost:1500+PORT[p.tier].setup/2,cap:lagCap(pniG(p),n()+1),w:'+1×'+pniPN(p),go:()=>ACT.lagP({id:p.id,d:1})}:null,
|
||||
ups:()=>{const out=[];for(let t=p.g1?0:p.tier+1;t<PORT.length&&portShown(t);t++){const q=pniQuote(c,p.net,t,resv(c));if(q&&!q.why)out.push({cost:q.cost,cap:lagCap(PORT[t].g,n()),w:pniPN(p)+'→'+PORT[t].n,go:()=>ACT.pni({city:c,net:p.net,tier:t})});}return out;}});}
|
||||
// Nominal capacity, not ixCap(): a LACP fault or one building down halves a LAG for a day or two, not worth a bigger port.
|
||||
for(const x in S.ixp){const c=ixCity(x),use=R.useIx[x]||0,n=()=>(S.ixn||{})[x]||1,cap=()=>lagCap(PORT[S.ixp[x]].g,n())*(isRemote(x)?REMOTE_CAP:1),pop=S.pops[c];if(S.myIx[x]||!(use>0)||!(cap()>0)||cap()>=N*use||!opsHere('ports',c))continue;
|
||||
for(const x in S.ixp){const c=ixCity(x),use=(R.useIx[x]||0)*opsAhead(),n=()=>(S.ixn||{})[x]||1,cap=()=>lagCap(PORT[S.ixp[x]].g,n())*(isRemote(x)?REMOTE_CAP:1),pop=S.pops[c];if(S.myIx[x]||!(use>0)||!(cap()>0)||cap()>=N*use||!opsHere('ports',c))continue;
|
||||
const g=()=>PORT[S.ixp[x]].g;
|
||||
L.push({city:c,at:x,use,u:use/cap(),cap,n,rt:pop?pop.routers||1:1,busy:()=>false,sig:()=>S.ixp[x]+','+n(),
|
||||
lag:()=>pop&&n()<LAG_MAX&&PORT_SLOT(S.ixp[x])<=room(c)?{cost:ixPortMo(x,S.ixp[x]),cap:cap()*lagCap(g(),n()+1)/lagCap(g(),n()),w:'+1×'+PORT[S.ixp[x]].n,go:()=>ACT.lagIx({city:x,d:1})}:null,
|
||||
|
|
@ -199,7 +203,7 @@ const OPS_RUN={
|
|||
X.did('ports',o.at+' '+job.w);}},
|
||||
optics(X){const at=opsP('optics','at')/100,big=opsP('optics','pick')==='big',gpd=(o,l)=>optG(o,l)/optCost(o);
|
||||
for(const l of S.links){if(l.kind!=='df'||l.ready>S.day||l.eqDown>S.day||l.standby||l.cut>S.day)continue;
|
||||
let cap=dfCap(l);const load=(R.load&&R.load[l.id])||0;
|
||||
let cap=dfCap(l);const load=((R.load&&R.load[l.id])||0)*opsAhead();
|
||||
// New fiber gets its first channel; lit fiber gets more while it runs hot.
|
||||
for(let step=0;step<8&&(cap<=0?!(l.ch||[]).length:load>=cap*at);step++){if(chMax(l)-(l.ch||[]).length-soldSlots(l)<=0)break;
|
||||
const cnt={};for(const k of l.ch||[])cnt[k]=(cnt[k]||0)+1;
|
||||
|
|
@ -211,12 +215,12 @@ const OPS_RUN={
|
|||
X.pay('optics',()=>{ACT.setChCount({id:l.id,o,n});return (l.ch||[]).length>before;});if((l.ch||[]).length<=before)break;
|
||||
cap+=optG(o,l);X.did('optics',l.a+'|'+l.b);}}},
|
||||
optup(X){const at=opsP('optup','at')/100,goal=opsP('optup','sys'),swap=opsP('optup','swap');let ups=0,tries=0;
|
||||
const hot=l=>{const c=dfCap(l);return c>0&&((R.load&&R.load[l.id])||0)>=c*at;},full=l=>freeCh(l)<=0,u=l=>((R.load&&R.load[l.id])||0)/Math.max(1,dfCap(l));
|
||||
const hot=l=>{const c=dfCap(l);return c>0&&((R.load&&R.load[l.id])||0)*opsAhead()>=c*at;},full=l=>freeCh(l)<=0,u=l=>((R.load&&R.load[l.id])||0)/Math.max(1,dfCap(l));
|
||||
const ls=S.links.filter(l=>l.kind==='df'&&!l.seat&&l.ready<=S.day&&!(l.eqDown>S.day)&&!(l.cut>S.day)).sort((a,b)=>u(b)-u(a));
|
||||
for(const l of ls){
|
||||
// The line system: one step at a time up to the chosen one, or the next one where the fiber is full and hot.
|
||||
const want=goal==='next'?(full(l)&&hot(l)?sysNext(l):null):SYS_RANK[l.sys]<SYS_RANK[goal]?goal:null;
|
||||
if(want&&ups<OPTUP_MAX&&tries<OPTUP_TRY){const to=sysNext(l),cost=sysUpCost(l);
|
||||
if(want&&ups<OPTUP_MAX*(opsIs('kevin')?2:1)&&tries<OPTUP_TRY*(opsIs('kevin')?2:1)){const to=sysNext(l),cost=sysUpCost(l);
|
||||
if(to&&techOk('sys',to,DF_SYS[to].lvl)&&!(OPTUP_NO.get(l.id)>S.day)&&X.can('optup',cost)){tries++;const ok=opsDarkOk(l,X);if(!ok)OPTUP_NO.set(l.id,S.day+OPTUP_WAIT);
|
||||
if(ok){const s0=l.sys,top=goal==='next'?to:goal;
|
||||
for(let k=0;k<2&&sysNext(l)&&SYS_RANK[l.sys]<SYS_RANK[top];k++){const nx=sysNext(l);
|
||||
|
|
@ -242,10 +246,10 @@ const OPS_RUN={
|
|||
const want=q.add.filter(x=>cacheDem(c,x.net)>=g),free=()=>portsMax(c)-portsUsed(c)+1e-9;
|
||||
for(const x of want){if(cachePortsAdd(c,[x])>free())continue;if(!X.can('caches',0,cacheMo(x)))return;S.caches.push({id:uid(),city:c,net:x.net,site:x.site,...(x.g?{g:x.g}:{})});X.book('caches',0,cacheMo(x));X.did('caches',c);}}},
|
||||
// Weekly, like a person going through PeeringDB on a Monday: route servers, then every willing member (#192).
|
||||
ix(X){if(S.day%7)return;for(const ix of utilityRouteServers()){S.rs[ix]=true;X.did('rs');}
|
||||
ix(X){if(S.day%7&&!opsIs('annie'))return;for(const ix of utilityRouteServers()){S.rs[ix]=true;X.did('rs');}
|
||||
for(const row of utilityPeers())for(const id of row.requests){S.peers[id+'@'+row.ix]=true;X.did('peer',row.ix);}},
|
||||
// Weekly too: every willing network above the threshold, at its own minimum size and lead time (#181).
|
||||
pni(X){if(S.day%7!==3)return;const b=pniBatch(null,opsP('pni','tier'));if(!b)return;const g=opsP('pni','g'),paid=opsP('pni','paid');
|
||||
pni(X){if(S.day%7!==3&&!(opsIs('annie')&&S.day%7===6))return;const b=pniBatch(null,opsP('pni','tier'));if(!b)return;const g=opsP('pni','g'),paid=opsP('pni','paid');
|
||||
// The traffic a PNI there would take over: what your users at that POP send to the network today over transit, an
|
||||
// exchange or a PNI elsewhere, the same figure the PNI list shows. Not the city's whole demand: a network's own
|
||||
// cache boxes in that POP already serve most of it (#244).
|
||||
|
|
@ -290,9 +294,11 @@ function opsDay(d){if(!opsHired())return;const O=S.ops,m=monthIdx(d);if(m!==O.mo
|
|||
opsQuiet(()=>{for(const k of OPS_ORDER)if(O.on[k])try{OPS_RUN[k](X);}catch(err){O.on[k]=false;X.dirty=true;X.did('snag',k);console.error('[tubes] standing order failed',k,err);}});
|
||||
const e={d,i:O.intern,r:[]};for(const [k,x] of X.r)e.r.push([k,x.n,x.w]);if(X.broke.size)e.r.push(['broke',X.broke.size,[...X.broke]]);
|
||||
// Very rarely, and never under Change Freeze, the intern fat-fingers something harmless.
|
||||
// Kevin rolls the same dice (so a seeded game plays the same whoever is hired) and catches it before pressing Enter.
|
||||
const ff=OPS_FF_RATE[rulePreset()];if(ff&&Object.keys(S.pops).length&&Math.random()<ff){const c=pick(Object.keys(S.pops));let f=Math.floor(Math.random()*OPS_FF.length);
|
||||
if(!opsIs('kevin')){
|
||||
if(f===3){const t=O.on.transit&&opsHere('transit',c)&&!scnRule('noTransit')&&S.transit.find(t=>t.city===c&&(t.n||1)<LAG_MAX&&portOk(c,t.tier)&&PORT[t.tier].setup<=Math.min(20000,S.cash*0.05));if(!t||!opsQuiet(()=>X.pay('transit',()=>ACT.lagT({id:t.id,d:1}))))f=0;else X.dirty=true;}
|
||||
e.f=f;e.c=c;toast(esc(opsFFLine(e)),'',[{l:tr('ops.ops'),act:'opsOpen',args:{}}]);}
|
||||
e.f=f;e.c=c;toast(esc(opsFFLine(e)),'',[{l:tr('ops.ops'),act:'opsOpen',args:{}}]);}}
|
||||
if(X.up)e.up=Math.round(X.up);if(Math.round(X.mo))e.mo=Math.round(X.mo);
|
||||
// Stopping at a budget changes nothing a route depends on: no recompute for that.
|
||||
if(X.dirty)compute();
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ function opsOrderHtml(d){const k=d.k,on=S.ops.on[k],cap=d.cap?opsCap(k):0,sp=S.o
|
|||
function opsModal(){if(!S)return;const hired=opsHired();let h=`<div style="display:flex;align-items:center"><div><div class="eyebrow">${tr('ops.ops')}</div><h2 style="font-size:26px">${tr('ops.standing_orders')}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>`;
|
||||
if(!hired){h+=`<p class="tagline">${tr('ops.hire_pitch_weekly')}</p>`;
|
||||
if(!rule('clock'))h+=`<p class="why">${tr('ops.no_clock')}</p>`;else if(!opsCanHire())h+=`<p class="why">${tr('ops.locked',{lv:2})}</p>`;
|
||||
else h+=Object.entries(INTERNS).map(([id,I])=>`<div class="ops-o"><div class="ops-h"><span class="ops-i" aria-hidden="true">${I.i}</span><div class="grow"><div class="nm">${tr(I.n)}</div><div class="meta">${tr(I.d)}</div></div>
|
||||
else h+=Object.entries(INTERNS).map(([id,I])=>`<div class="ops-o"><div class="ops-h"><span class="ops-i" aria-hidden="true">${I.i}</span><div class="grow"><div class="nm">${tr(I.n)}</div><div class="meta">${tr(I.d)}</div><div class="ops-good">${tr(I.g)}</div></div>
|
||||
${btn(tr('ops.hire_mo',{price:fmt$(INTERN_MO)}),'opsHire',{id},'pink sm',S.cash<INTERN_MO)}</div></div>`).join('');
|
||||
openModal(h+opsOnceHtml(),'ops');return;}
|
||||
const O=S.ops,I=INTERNS[O.intern];
|
||||
h+=`<div class="ops-o on"><div class="ops-h"><span class="ops-i" aria-hidden="true">${I.i}</span><div class="grow"><div class="nm">${tr(I.n)}</div><div class="meta">${tr('ops.salary',{price:fmt$(INTERN_MO),d:dateStr(O.hired)})}</div></div>
|
||||
h+=`<div class="ops-o on"><div class="ops-h"><span class="ops-i" aria-hidden="true">${I.i}</span><div class="grow"><div class="nm">${tr(I.n)}</div><div class="meta">${tr('ops.salary',{price:fmt$(INTERN_MO),d:dateStr(O.hired)})}</div><div class="ops-good">${tr(I.g)}</div></div>
|
||||
${btn(UI.confirm==='opsFire'?tr('ops.really_fire'):tr('ops.fire'),'opsFire',{},'ghost sm')}</div>
|
||||
<p class="ops-mood">${esc(opsMood())}</p>${opsReportHtml()}
|
||||
${O.log.length?`<pre class="term ops-log">${O.log.slice(0,6).map(e=>esc(tr('ops.day_d',{d:e.d})+': '+opsEntry(e))).join('\n')}</pre>`:''}
|
||||
|
|
|
|||
|
|
@ -3212,6 +3212,9 @@
|
|||
"ops.fire":"Let go",
|
||||
"ops.fired":"{name} handed in the badge and took the good stapler. Your standing orders are paused.",
|
||||
"ops.floor":"Keep at least",
|
||||
"ops.good_annie":"Best at peering: works through the exchanges every day, not weekly, and orders PNIs twice a week.",
|
||||
"ops.good_kevin":"Best at maintenance: two line system swaps a night instead of one, and never a fat finger.",
|
||||
"ops.good_tracy":"Best at planning ahead: buys transit, ports, routers and optics as if traffic were already 10% higher.",
|
||||
"ops.hire_an_intern":"Hire a NOC intern",
|
||||
"ops.hire_mo":"Hire · {price}/mo",
|
||||
"ops.hire_pitch_short":"Set the rules once, and an intern clicks the buttons every day.",
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@
|
|||
.ops-sel{display:flex;flex-direction:column;gap:2px;flex:1 1 140px;min-width:0;font:800 12px Nunito,sans-serif;color:var(--ink2)}
|
||||
.ops-sel select{width:100%;min-height:36px;font:700 14px Nunito,sans-serif;color:var(--ink);background:var(--paper);padding:4px 6px;border:2px solid var(--ink);border-radius:8px}
|
||||
.ops-log{white-space:pre-wrap;font-size:11.5px;max-height:160px;overflow:auto}
|
||||
.ops-good{font-size:12.5px;font-weight:800;color:#6B3FD4;margin-top:2px;line-height:1.3}
|
||||
.ops-mood{margin:6px 0 0;font-style:italic;font-size:13px;color:var(--ink2)}
|
||||
.ops-rep{border-left:3px solid #8E5CF7;background:#F7F2FF;border-radius:0 8px 8px 0;padding:6px 8px;margin:6px 0;font-size:13px;line-height:1.35;overflow-wrap:anywhere}
|
||||
.ops-rep .eyebrow{margin-bottom:2px}
|
||||
|
|
|
|||
|
|
@ -6,12 +6,13 @@ const { load } = require('./harness');
|
|||
|
||||
// Frankfurt (transit) and Amsterdam (broadband) joined by a full Rainbow-in-a-Box fiber of 16×400G, and the long way
|
||||
// round through Paris on two waves. Level 6: every line system and optic unlocked. Change Freeze: no fat fingers.
|
||||
// Annie runs the shift: Kevin would swap two line systems a night (tests/intern-personas.test.js).
|
||||
const BASE = "ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;S.lvl=6;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');" +
|
||||
"for(const c of ['ams','par'])ACT.buildPop({city:c});for(const c of ['fra','ams','par']){S.pops[c].rgen=mainRG(3);S.pops[c].routers=2;}ACT.launchBB({city:'ams'});" +
|
||||
"S.transit=[];ACT.buyTransit({city:'fra',net:'cog',tier:2});" +
|
||||
"S.links=[{id:'f',a:'fra',b:'ams',kind:'df',own:true,sys:'lite',ch:Array(16).fill('zr4'),km:450,trench:'t1',ready:0,cut:0,mo:1,pairs:1}," +
|
||||
"{id:'w1',a:'fra',b:'par',kind:'wave',tier:4,km:480,cut:0,mo:1},{id:'w2',a:'par',b:'ams',kind:'wave',tier:4,km:430,cut:0,mo:1}];compute();" +
|
||||
"ACT.opsHire({id:'kevin'});S.ops.floor=0;S.ops.cap.optup=0;closeModal()";
|
||||
"ACT.opsHire({id:'annie'});S.ops.floor=0;S.ops.cap.optup=0;closeModal()";
|
||||
function game(t, extra) {
|
||||
const h = load();
|
||||
t.after(() => h.dom.window.close());
|
||||
|
|
|
|||
86
tests/intern-personas.test.js
Normal file
86
tests/intern-personas.test.js
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
// The three interns run the same orders the same way, at the same salary; each is better at one part of the job.
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
const BASE = "ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;S.lvl=6;S.nextFail=S.nextEvent=1e9;UI.speed=0;S.rules=makeRules('freeze');" +
|
||||
"ACT.launchBB({city:'fra'});S.pops.fra.rgen=1;ACT.buyTransit({city:'fra',net:'cog',tier:1});compute()";
|
||||
function game(t, id, extra) {
|
||||
const h = load();
|
||||
t.after(() => h.dom.window.close());
|
||||
h.ev(BASE);
|
||||
if (extra) h.ev(extra);
|
||||
h.ev(`ACT.opsHire({id:'${id}'});S.ops.floor=0;S.ops.cap={};closeModal()`);
|
||||
return h;
|
||||
}
|
||||
|
||||
test('the same salary, and each says what they are best at, in the hiring list and once hired', t => {
|
||||
const h = load();
|
||||
t.after(() => h.dom.window.close());
|
||||
h.ev(BASE);
|
||||
assert.ok(h.ev("Object.values(INTERNS).every(I=>I.g)"));
|
||||
h.dom.window.innerWidth = 360;
|
||||
h.ev('opsModal()');
|
||||
const txt = h.ev("document.getElementById('modalCard').textContent");
|
||||
for (const s of [/Best at peering/, /Best at maintenance/, /Best at planning ahead/]) assert.match(txt, s);
|
||||
assert.equal(h.ev("document.querySelectorAll('#modalCard [data-act=opsHire]').length"), 3);
|
||||
assert.equal(h.ev("[...document.querySelectorAll('#modalCard [data-act=opsHire]')].every(b=>b.textContent.includes(fmt$(INTERN_MO)))"), true, 'one salary for all');
|
||||
h.ev("ACT.opsHire({id:'tracy'})");
|
||||
assert.match(h.ev("document.getElementById('modalCard').textContent"), /Best at planning ahead/);
|
||||
assert.deepEqual(h.errors, []);
|
||||
});
|
||||
|
||||
test('Annie peers every day and orders PNIs twice a week; the others weekly', t => {
|
||||
const ix = "ACT.buyIx({city:'fra',tier:0,signed:true});compute()";
|
||||
for (const [id, want] of [['annie', true], ['kevin', false], ['tracy', false]]) {
|
||||
const { ev, errors } = game(t, id, ix);
|
||||
ev("S.ops.on.ix=true;S.day=15;opsDay(S.day)");
|
||||
assert.equal(ev('Object.keys(S.rs).length>0'), want, `${id} on a Tuesday`);
|
||||
// How often the PNI order looks for networks to order from, over one week.
|
||||
ev("S.ops.on.ix=false;S.ops.on.pni=true;window.__pb=0;pniBatch=function(){__pb++;return null;};for(let d=21;d<28;d++){S.day=d;opsDay(d);}");
|
||||
assert.equal(ev('__pb'), want ? 2 : 1, `${id}: PNI rounds a week`);
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
});
|
||||
|
||||
test('Kevin never fat-fingers, even on the unluckiest roll', t => {
|
||||
for (const [id, want] of [['kevin', false], ['annie', true], ['tracy', true]]) {
|
||||
const { ev, errors } = game(t, id);
|
||||
ev("S.rules=makeRules('bgp');window.__r=Math.random;Math.random=()=>0;opsDay(S.day);Math.random=__r");
|
||||
assert.equal(ev('S.ops.log.some(e=>e.f!==undefined)'), want, id);
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
});
|
||||
|
||||
test('Kevin swaps two line systems a night, the others one', t => {
|
||||
const fibers = "for(const c of ['ams','par'])ACT.buildPop({city:c});for(const c of ['fra','ams','par']){S.pops[c].rgen=mainRG(3);S.pops[c].routers=2;}" +
|
||||
"S.links=[['f1','fra','ams'],['f2','ams','par'],['f3','par','fra'],['f4','fra','ams']].map(([id,a,b])=>({id,a,b,kind:'df',own:true,sys:'lite',ch:['zr4'],km:450,trench:id,ready:0,cut:0,mo:1,pairs:1}));compute()";
|
||||
for (const [id, want] of [['kevin', 2], ['annie', 1], ['tracy', 1]]) {
|
||||
const { ev, errors } = game(t, id, fibers);
|
||||
ev("S.ops.on.optup=true;S.ops.p.optup={sys:'roadm'};opsDay(S.day)");
|
||||
assert.equal(ev("S.links.filter(l=>l.sys==='roadm').length"), want, id);
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
});
|
||||
|
||||
test('Tracy buys a little before it runs hot; at the same price as anyone', t => {
|
||||
// A POP at 75% with the order set to 80%: Tracy sees 82.5% and adds a router; the others wait.
|
||||
for (const [id, want] of [['tracy', 2], ['kevin', 1], ['annie', 1]]) {
|
||||
const { ev, errors } = game(t, id);
|
||||
ev("S.ops.on.routers=true;S.ops.p.routers={at:80,how:'add'};compute();R.nodeLoad.fra=R.nodeCap.fra*0.75");
|
||||
const cost = ev("routerCost(S.pops.fra.rgen||0,S.pops.fra.routers||1)"), c0 = ev('S.cash');
|
||||
ev('opsDay(S.day)');
|
||||
assert.equal(ev('S.pops.fra.routers'), want, id);
|
||||
if (want === 2) assert.equal(c0 - ev('S.cash'), cost, 'what Add router costs');
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
// Transit too: a 30-day peak that the headroom just covers, but not with 10% more.
|
||||
for (const [id, grew] of [['tracy', true], ['kevin', false]]) {
|
||||
const { ev, errors } = game(t, id);
|
||||
ev("S.ops.on.transit=true;S.ops.p.transit={x:1.25,prov:'have'};const t=S.transit[0];t.hist=[lagCap(PORT[t.tier].g,t.n)/1.25/1.05]");
|
||||
const n0 = ev('JSON.stringify(S.transit.map(t=>[t.tier,t.n||1]))');
|
||||
ev('opsDay(S.day)');
|
||||
assert.equal(ev('JSON.stringify(S.transit.map(t=>[t.tier,t.n||1]))') !== n0, grew, id);
|
||||
assert.deepEqual(errors, []);
|
||||
}
|
||||
});
|
||||
|
|
@ -284,7 +284,8 @@ test('the mood follows the week, with no dice', t => {
|
|||
|
||||
test('fat fingers: never under Change Freeze, rare and harmless in On-call and BGP at 3 a.m.', t => {
|
||||
const { ev, errors } = game(t);
|
||||
hire(ev);
|
||||
// Kevin never fat-fingers anything: Annie does, now and then.
|
||||
ev("ACT.opsHire({id:'annie'});S.ops.floor=0;closeModal()");
|
||||
ev('window.__r=Math.random;Math.random=()=>0');
|
||||
for (let i = 0; i < 50; i++) shift(ev);
|
||||
assert.equal(ev('S.ops.log.some(e=>e.f!==undefined)'), false, 'Change Freeze: never, even on the unluckiest roll');
|
||||
|
|
@ -477,7 +478,8 @@ test('one order that throws is paused and noted; the rest of the shift and the d
|
|||
|
||||
test('the fat-fingered LAG member respects a paused transit order and per-POP exceptions', t => {
|
||||
const { ev, errors } = game(t);
|
||||
hire(ev);
|
||||
// Kevin never fat-fingers anything: Annie does, now and then.
|
||||
ev("ACT.opsHire({id:'annie'});S.ops.floor=0;closeModal()");
|
||||
// Each shift rolls: fat finger yes, the only POP, the LAG slip (index 3).
|
||||
ev("S.rules=makeRules('bgp');window.__r=Math.random;window.__k=0;Math.random=()=>[0,0,0.7][__k++%3]");
|
||||
const n0 = ev('S.transit[0].n||1'), c0 = cash(ev);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue