Architect runs: a chaos monkey runs round the map snipping tubes

The review is now an animated monkey that hops from cut to cut and sprays
chaos where it snips, instead of the backhoe.
This commit is contained in:
Frederic Jung 2026-10-30 09:25:20 +01:00
parent ab05c80d68
commit b3351fb7d9
No known key found for this signature in database
13 changed files with 96 additions and 60 deletions

View file

@ -6,7 +6,7 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
- Architect runs (preview), under Puzzles: grow one network brief by brief, from a single tube to a ring that shrugs off any cut. Your build carries over between briefs, mission-critical sites must survive any single trench or cable cut with room on the detour, and a backhoe checks every design before the next customer signs. Three runs to start: Euro Run, Coast to Coast and Pacific Rim.
- Architect runs (preview), under Puzzles: grow one network brief by brief, from a single tube to a ring that shrugs off any cut. Your build carries over between briefs, mission-critical sites must survive any single trench or cable cut with room on the detour, and a chaos monkey runs round the map snipping tubes before the next customer signs. Three runs to start: Euro Run, Coast to Coast and Pacific Rim.
## [2.0.0] — 2026-10-29

View file

@ -14,9 +14,9 @@
"action_helpers.too_far_even_at_its_slowest":"Zu weit, selbst in der langsamsten Einstellung: Ein optischer Abschnitt ist hier {span} km lang, die Reichweite beträgt {max} km. Füge einen Regenerator-Standort hinzu (Line System).",
"action_helpers.unlocks_at_customer_level_n":"Wird ab Kundenlevel {n} freigeschaltet.",
"actions.your_router_can_t_take_a":"<b>Dein Router kann keinen {port}-Port aufnehmen.</b><br>Rüste ihn im Tab Infra auf.",
"architect.anchor":"⚓ Anker!",
"architect.anchor":"🐒 Platsch!",
"architect.architect_runs":"Architekt-Runs",
"architect.backhoe":"🚜 Bagger!",
"architect.backhoe":"🐒 Schnipp!",
"architect.best_n_briefs":"Rekord: {n} Aufträge",
"architect.brief_n_of_m":"Auftrag {n} von {m}",
"architect.briefs_done":"Aufträge erledigt",
@ -44,7 +44,7 @@
"architect.euro_run":"Euro-Run",
"architect.euro_run_joke":"Sechs Aufträge, ein Vermieter, eine sehr nervöse Bank.",
"architect.finish_the_run":"Run beenden",
"architect.fix_it_and_send_it_again":"Reparier es und schick den Bagger noch mal los.",
"architect.fix_it_and_send_it_again":"Reparier es und lass den Chaos-Affen noch mal los.",
"architect.from_x":"ab {x}",
"architect.gold_lead":"Geschäftskritisch: Dieser Standort muss mit dem HQ verbunden bleiben, egal welcher einzelne Graben oder welches Kabel gekappt wird, und der Umweg braucht Platz für seinen Verkehr.",
"architect.gold_must_survive":"Muss jeden einzelnen Schnitt überleben: {list}",
@ -58,7 +58,7 @@
"architect.lay_a_tube_to":"Röhre legen nach",
"architect.line_1":"Läuft. Die Buchhaltung hätte da noch Fragen.",
"architect.line_2":"Solides Design, ein bisschen vergoldet. Damit kann die Buchhaltung leben.",
"architect.line_3":"Im Plan oder besser. Der Bagger ist gelangweilt heimgefahren.",
"architect.line_3":"Auf Par oder besser. Der Chaos-Affe ist gelangweilt heimgegangen.",
"architect.move_out_of_city":"Zieh zuerst aus {city} aus.",
"architect.n_briefs":"{n} Aufträge",
"architect.n_over_plan":"{n} über Plan",
@ -79,8 +79,8 @@
"architect.pacific_rim":"Pacific Rim",
"architect.pacific_rim_joke":"Ozeane, Anker und sehr teures Glas.",
"architect.plus_router_x":"+ größerer Router {x}",
"architect.ready_no_gold_yet":"Bereit. Noch ist nichts geschäftskritisch, der Bagger kann also nur Chaos anrichten.",
"architect.ready_send_the_backhoe":"Fertig. Schick den Bagger los und schau, was überlebt.",
"architect.ready_no_gold_yet":"Bereit. Noch ist nichts geschäftskritisch, der Chaos-Affe kann also nur Chaos anrichten.",
"architect.ready_send_the_backhoe":"Bereit. Lass den Chaos-Affen los und schau, was überlebt.",
"architect.reset_brief":"Auftrag zurücksetzen",
"architect.review_passed":"Abnahme bestanden",
"architect.ring_list":"Ein Ring durch {list}",
@ -88,8 +88,8 @@
"architect.router_x":"Router: {x}",
"architect.run_complete":"Run geschafft",
"architect.run_over":"Run vorbei",
"architect.runs_lead":"Ein Netz, Auftrag für Auftrag gebaut. Was du baust, bleibt stehen, und ein Bagger prüft jedes Design: Kapp eine beliebige Röhre, und alles, was noch verbunden ist, muss seinen ganzen Traffic bekommen.",
"architect.send_the_backhoe":"Bagger losschicken",
"architect.runs_lead":"Ein Netz, Auftrag für Auftrag gebaut. Dein Ausbau bleibt bestehen, und ein Chaos-Affe testet jeden Entwurf: Er kappt eine Röhre nach der anderen, und alles, was noch verbunden ist, muss seinen ganzen Verkehr bekommen.",
"architect.send_the_backhoe":"Lass den Chaos-Affen los",
"architect.shape_braces":"Doppelt hält besser",
"architect.shape_full":"Full Mesh",
"architect.shape_islands":"Inseln",

View file

@ -12,9 +12,9 @@
"action_helpers.too_far_even_at_its_slowest":"Demasiado lejos incluso en su ajuste más lento: aquí un tramo óptico mide {span} km y el alcance es de {max} km. Añade un sitio regenerador (Sistema de línea).",
"action_helpers.unlocks_at_customer_level_n":"Se desbloquea en el nivel de cliente {n}.",
"actions.your_router_can_t_take_a":"<b>Tu router no admite un puerto de {port}.</b><br>Mejóralo en la pestaña Infra.",
"architect.anchor":"⚓ ¡Ancla!",
"architect.anchor":"🐒 ¡Chof!",
"architect.architect_runs":"Partidas de arquitecto",
"architect.backhoe":"🚜 ¡Retroexcavadora!",
"architect.backhoe":"🐒 ¡Zas!",
"architect.best_n_briefs":"récord: {n} encargos",
"architect.brief_n_of_m":"Encargo {n} de {m}",
"architect.briefs_done":"Encargos hechos",
@ -42,7 +42,7 @@
"architect.euro_run":"Ruta europea",
"architect.euro_run_joke":"Seis encargos, un casero y un banco muy nervioso.",
"architect.finish_the_run":"Terminar la partida",
"architect.fix_it_and_send_it_again":"Arréglalo y vuelve a mandar la retroexcavadora.",
"architect.fix_it_and_send_it_again":"Arréglalo y vuelve a soltar al mono del caos.",
"architect.from_x":"desde {x}",
"architect.gold_lead":"Crítico: este sitio debe seguir conectado a la sede corte quien corte una sola zanja o cable, y el desvío necesita sitio para su tráfico.",
"architect.gold_must_survive":"Debe sobrevivir a cualquier corte: {list}",
@ -56,7 +56,7 @@
"architect.lay_a_tube_to":"Tender un tubo a",
"architect.line_1":"Funciona. Finanzas quiere hablar contigo.",
"architect.line_2":"Diseño sólido, un poco bañado en oro. Finanzas puede vivir con ello.",
"architect.line_3":"En presupuesto o mejor. La retroexcavadora se fue a casa aburrida.",
"architect.line_3":"En par o mejor. El mono del caos se fue a casa aburrido.",
"architect.move_out_of_city":"Primero sal de {city}.",
"architect.n_briefs":"{n} encargos",
"architect.n_over_plan":"{n} por encima del plan",
@ -77,8 +77,8 @@
"architect.pacific_rim":"Cinturón del Pacífico",
"architect.pacific_rim_joke":"Océanos, anclas y vidrio carísimo.",
"architect.plus_router_x":"+ router más grande {x}",
"architect.ready_no_gold_yet":"Listo. Aún no hay nada crítico, así que la retroexcavadora solo puede armar lío.",
"architect.ready_send_the_backhoe":"Listo. Manda la retroexcavadora y mira qué sobrevive.",
"architect.ready_no_gold_yet":"Listo. Aún no hay nada crítico, así que el mono del caos solo puede armar lío.",
"architect.ready_send_the_backhoe":"Listo. Suelta al mono del caos y mira qué sobrevive.",
"architect.reset_brief":"Reiniciar encargo",
"architect.review_passed":"Revisión superada",
"architect.ring_list":"Un anillo por {list}",
@ -86,8 +86,8 @@
"architect.router_x":"Router: {x}",
"architect.run_complete":"Partida completada",
"architect.run_over":"Partida terminada",
"architect.runs_lead":"Una red, construida encargo a encargo. Lo que construyes se queda, y una retroexcavadora revisa cada diseño: corta cualquier tubo, y todo lo que siga conectado debe recibir todo su tráfico.",
"architect.send_the_backhoe":"Mandar la retroexcavadora",
"architect.runs_lead":"Una red, construida encargo a encargo. Lo que construyes se queda, y un mono del caos prueba cada diseño: corta un tubo cada vez, y todo lo que siga conectado debe recibir todo su tráfico.",
"architect.send_the_backhoe":"Suelta al mono del caos",
"architect.shape_braces":"Cinturón y tirantes",
"architect.shape_full":"Malla completa",
"architect.shape_islands":"Islas",

View file

@ -12,9 +12,9 @@
"action_helpers.too_far_even_at_its_slowest":"Trop loin, même au débit le plus lent : ici une portée optique fait {span} km et l’optique va jusqu’à {max} km. Ajoute un site de régénération (Système de ligne).",
"action_helpers.unlocks_at_customer_level_n":"Se débloque au niveau client {n}.",
"actions.your_router_can_t_take_a":"<b>Ton routeur ne supporte pas de port {port}.</b><br>Mets-le à niveau dans l’onglet Infra.",
"architect.anchor":"⚓ Ancre !",
"architect.anchor":"🐒 Plouf !",
"architect.architect_runs":"Parties d’architecte",
"architect.backhoe":"🚜 Pelleteuse !",
"architect.backhoe":"🐒 Clac !",
"architect.best_n_briefs":"record : {n} briefs",
"architect.brief_n_of_m":"Brief {n} sur {m}",
"architect.briefs_done":"Briefs terminés",
@ -42,7 +42,7 @@
"architect.euro_run":"Euro Run",
"architect.euro_run_joke":"Six briefs, un proprio, une banque très nerveuse.",
"architect.finish_the_run":"Terminer la partie",
"architect.fix_it_and_send_it_again":"Répare, puis renvoie la pelleteuse.",
"architect.fix_it_and_send_it_again":"Répare, puis relâche le singe du chaos.",
"architect.from_x":"dès {x}",
"architect.gold_lead":"Critique : ce site doit rester relié au siège quelle que soit la tranchée ou le câble coupé, et le détour doit avoir de la place pour son trafic.",
"architect.gold_must_survive":"Doit survivre à n’importe quelle coupure : {list}",
@ -56,7 +56,7 @@
"architect.lay_a_tube_to":"Poser un tube vers",
"architect.line_1":"Ça marche. La compta aimerait te dire un mot.",
"architect.line_2":"Design solide, un peu plaqué or. La compta peut vivre avec.",
"architect.line_3":"Dans le budget, voire mieux. La pelleteuse est rentrée chez elle en s’ennuyant.",
"architect.line_3":"Au par ou mieux. Le singe du chaos est rentré s’ennuyer chez lui.",
"architect.move_out_of_city":"Quitte d’abord {city}.",
"architect.n_briefs":"{n} briefs",
"architect.n_over_plan":"{n} au-delà du plan",
@ -77,8 +77,8 @@
"architect.pacific_rim":"Ceinture du Pacifique",
"architect.pacific_rim_joke":"Des océans, des ancres et du verre hors de prix.",
"architect.plus_router_x":"+ routeur plus gros {x}",
"architect.ready_no_gold_yet":"Prêt. Rien n’est encore critique, donc la pelleteuse ne peut que faire des dégâts.",
"architect.ready_send_the_backhoe":"Prêt. Envoie la pelleteuse et regarde ce qui survit.",
"architect.ready_no_gold_yet":"Prêt. Rien n’est encore critique, donc le singe du chaos ne peut que faire des dégâts.",
"architect.ready_send_the_backhoe":"Prêt. Lâche le singe du chaos et regarde ce qui tient.",
"architect.reset_brief":"Recommencer le brief",
"architect.review_passed":"Revue validée",
"architect.ring_list":"Un anneau par {list}",
@ -86,8 +86,8 @@
"architect.router_x":"Routeur : {x}",
"architect.run_complete":"Partie terminée",
"architect.run_over":"Partie perdue",
"architect.runs_lead":"Un réseau, construit brief après brief. Ce que tu construis reste, et une pelleteuse vérifie chaque design : coupe n’importe quel tube, et tout ce qui est encore relié doit recevoir tout son trafic.",
"architect.send_the_backhoe":"Envoyer la pelleteuse",
"architect.runs_lead":"Un réseau, construit brief après brief. Ce que tu construis reste, et un singe du chaos teste chaque design : il coupe un tube à la fois, et tout ce qui reste connecté doit recevoir tout son trafic.",
"architect.send_the_backhoe":"Lâche le singe du chaos",
"architect.shape_braces":"Ceinture et bretelles",
"architect.shape_full":"Maillage complet",
"architect.shape_islands":"Îles",

View file

@ -12,9 +12,9 @@
"action_helpers.too_far_even_at_its_slowest":"Troppo lontano anche alla velocità più bassa: qui una tratta ottica è di {span} km e l’ottica arriva a {max} km. Aggiungi un sito di rigenerazione (Sistema di linea).",
"action_helpers.unlocks_at_customer_level_n":"Si sblocca al livello cliente {n}.",
"actions.your_router_can_t_take_a":"<b>Il tuo router non regge una porta {port}.</b><br>Aggiornalo nella scheda Infra.",
"architect.anchor":"⚓ Ancora!",
"architect.anchor":"🐒 Splash!",
"architect.architect_runs":"Partite da architetto",
"architect.backhoe":"🚜 Ruspa!",
"architect.backhoe":"🐒 Zac!",
"architect.best_n_briefs":"record: {n} incarichi",
"architect.brief_n_of_m":"Incarico {n} di {m}",
"architect.briefs_done":"Incarichi completati",
@ -42,7 +42,7 @@
"architect.euro_run":"Euro Run",
"architect.euro_run_joke":"Sei incarichi, un padrone di casa, una banca molto nervosa.",
"architect.finish_the_run":"Chiudi la partita",
"architect.fix_it_and_send_it_again":"Sistemalo, poi rimanda la ruspa.",
"architect.fix_it_and_send_it_again":"Sistema e libera di nuovo la scimmia del caos.",
"architect.from_x":"da {x}",
"architect.gold_lead":"Critico: questo sito deve restare collegato alla sede qualunque singolo scavo o cavo venga tagliato, e la deviazione deve avere spazio per il suo traffico.",
"architect.gold_must_survive":"Deve sopravvivere a qualsiasi taglio: {list}",
@ -56,7 +56,7 @@
"architect.lay_a_tube_to":"Posa un tubo verso",
"architect.line_1":"Funziona. L’amministrazione vorrebbe parlarti.",
"architect.line_2":"Progetto solido, un po’ placcato d’oro. L’amministrazione ci può convivere.",
"architect.line_3":"Nel budget o meglio. La ruspa è tornata a casa annoiata.",
"architect.line_3":"In par o meglio. La scimmia del caos è tornata a casa annoiata.",
"architect.move_out_of_city":"Prima lascia {city}.",
"architect.n_briefs":"{n} incarichi",
"architect.n_over_plan":"{n} oltre il piano",
@ -77,8 +77,8 @@
"architect.pacific_rim":"Anello del Pacifico",
"architect.pacific_rim_joke":"Oceani, ancore e vetro carissimo.",
"architect.plus_router_x":"+ router più grande {x}",
"architect.ready_no_gold_yet":"Pronto. Ancora niente di critico, quindi la ruspa può solo fare disastri.",
"architect.ready_send_the_backhoe":"Pronto. Manda la ruspa e guarda cosa sopravvive.",
"architect.ready_no_gold_yet":"Pronto. Ancora niente di critico, quindi la scimmia del caos può solo fare disastri.",
"architect.ready_send_the_backhoe":"Pronto. Libera la scimmia del caos e guarda cosa resiste.",
"architect.reset_brief":"Ricomincia l’incarico",
"architect.review_passed":"Revisione superata",
"architect.ring_list":"Un anello attraverso {list}",
@ -86,8 +86,8 @@
"architect.router_x":"Router: {x}",
"architect.run_complete":"Partita completata",
"architect.run_over":"Partita finita",
"architect.runs_lead":"Una rete, costruita un incarico alla volta. Quello che costruisci resta, e una ruspa controlla ogni progetto: taglia un tubo qualsiasi, e tutto ciò che resta collegato deve ricevere tutto il suo traffico.",
"architect.send_the_backhoe":"Manda la ruspa",
"architect.runs_lead":"Una rete, costruita incarico dopo incarico. Quello che costruisci resta, e una scimmia del caos mette alla prova ogni progetto: taglia un tubo alla volta, e tutto ciò che resta collegato deve ricevere tutto il suo traffico.",
"architect.send_the_backhoe":"Libera la scimmia del caos",
"architect.shape_braces":"Cintura e bretelle",
"architect.shape_full":"Full mesh",
"architect.shape_islands":"Isole",

View file

@ -12,9 +12,9 @@
"action_helpers.too_far_even_at_its_slowest":"Longe demais até na configuração mais lenta: um span óptico aqui tem {span} km e ela alcança {max} km. Adicione um site de regeneração (Line system).",
"action_helpers.unlocks_at_customer_level_n":"Desbloqueia no nível de cliente {n}.",
"actions.your_router_can_t_take_a":"<b>Seu router não aguenta uma porta {port}.</b><br>Faça upgrade na aba Infra.",
"architect.anchor":"⚓ Âncora!",
"architect.anchor":"🐒 Tchibum!",
"architect.architect_runs":"Partidas de arquiteto",
"architect.backhoe":"🚜 Retroescavadeira!",
"architect.backhoe":"🐒 Zás!",
"architect.best_n_briefs":"recorde: {n} pedidos",
"architect.brief_n_of_m":"Pedido {n} de {m}",
"architect.briefs_done":"Pedidos concluídos",
@ -42,7 +42,7 @@
"architect.euro_run":"Euro Run",
"architect.euro_run_joke":"Seis pedidos, um senhorio, um banco muito nervoso.",
"architect.finish_the_run":"Encerrar a partida",
"architect.fix_it_and_send_it_again":"Conserte e mande a retroescavadeira de novo.",
"architect.fix_it_and_send_it_again":"Conserte e solte o macaco do caos de novo.",
"architect.from_x":"a partir de {x}",
"architect.gold_lead":"Crítico: este local precisa continuar ligado à sede qualquer que seja a vala ou o cabo cortado, e o desvio precisa de espaço para o tráfego dele.",
"architect.gold_must_survive":"Precisa sobreviver a qualquer corte: {list}",
@ -56,7 +56,7 @@
"architect.lay_a_tube_to":"Lançar um tubo até",
"architect.line_1":"Funciona. O financeiro quer uma palavrinha.",
"architect.line_2":"Projeto sólido, meio banhado a ouro. O financeiro aguenta.",
"architect.line_3":"Dentro do orçamento ou melhor. A retroescavadeira voltou pra casa entediada.",
"architect.line_3":"No par ou melhor. O macaco do caos foi para casa entediado.",
"architect.move_out_of_city":"Saia de {city} primeiro.",
"architect.n_briefs":"{n} pedidos",
"architect.n_over_plan":"{n} acima do plano",
@ -77,8 +77,8 @@
"architect.pacific_rim":"Círculo do Pacífico",
"architect.pacific_rim_joke":"Oceanos, âncoras e vidro caríssimo.",
"architect.plus_router_x":"+ router maior {x}",
"architect.ready_no_gold_yet":"Pronto. Nada é crítico ainda, então a retroescavadeira só pode fazer bagunça.",
"architect.ready_send_the_backhoe":"Pronto. Mande a retroescavadeira e veja o que sobrevive.",
"architect.ready_no_gold_yet":"Pronto. Nada é crítico ainda, então o macaco do caos só pode fazer bagunça.",
"architect.ready_send_the_backhoe":"Pronto. Solte o macaco do caos e veja o que sobrevive.",
"architect.reset_brief":"Reiniciar pedido",
"architect.review_passed":"Revisão aprovada",
"architect.ring_list":"Um anel passando por {list}",
@ -86,8 +86,8 @@
"architect.router_x":"Router: {x}",
"architect.run_complete":"Partida concluída",
"architect.run_over":"Fim de partida",
"architect.runs_lead":"Uma rede, construída pedido a pedido. O que você constrói fica, e uma retroescavadeira testa cada projeto: corte qualquer tubo, e tudo que ainda estiver ligado precisa receber todo o seu tráfego.",
"architect.send_the_backhoe":"Mandar a retroescavadeira",
"architect.runs_lead":"Uma rede, construída pedido a pedido. O que você constrói fica, e um macaco do caos testa cada projeto: ele corta um tubo de cada vez, e tudo o que continuar ligado precisa receber todo o seu tráfego.",
"architect.send_the_backhoe":"Solte o macaco do caos",
"architect.shape_braces":"Cinto e suspensório",
"architect.shape_full":"Malha completa",
"architect.shape_islands":"Ilhas",

View file

@ -1,14 +1,14 @@
/* ================= ARCHITECT RUNS (prototype) =================
One network, built brief by brief. A brief adds sites, makes some of them gold (a gold site must stay connected to HQ
whichever single trench or cable is cut), sets a latency cap, or closes a city. The build carries over: what earlier
briefs built is paid for, so removing it gives nothing back. ▶ sends the backhoe: it cuts every trench and cable one
briefs built is paid for, so removing it gives nothing back. ▶ lets the chaos monkey loose: it cuts every trench and cable one
at a time, and the brief is done when every gold site survives. Runs on the puzzle machinery (S.mode 'puzzle' with
S.ar), so there is no clock, no bills, no incidents, and the main save is never touched.
Capacity: every site pulls its traffic from HQ, and the review also checks that the detour has room: after any single
cut, everything still connected gets all of its traffic. Tubes come in three sizes; routers follow by themselves (the
cheapest model that takes the tubes), and traffic finds the detour by itself (Auto-TE): models, ports and metrics are
someone else's job. */
const AR_KEY='sot-architect',AR_TIER=1,AR_TIERS=[0,1,2],AR_STEP=650;
const AR_KEY='sot-architect',AR_TIER=1,AR_TIERS=[0,1,2],AR_STEP=1000;
// A brief: add (new sites), gold (sites that must survive any single cut), ring (sites that must sit on one ring), drop
// (close a city: no POP allowed there any more), dem {city: Gbps} (what a site pulls from HQ, 10G unless set; a later
// brief can raise it), lat [a,b,ms] (the fastest path between two sites under ms), tubes (the
@ -136,23 +136,23 @@ function arReset(){const o=JSON.parse(S.ar.start);S.pops=o.p;S.links=o.l;S.pairM
const arOver=()=>S.ar.over+arTubes().over;
function arStars(sp){return 1+(arOver()?0:1)+(sp<=arRun().budget+1e-6?1:0);}
function arShareText(st,sp){const sh=arShape();return tr('architect.share_line',{what:arRun().n,stars:pzStarStr(st),spend:fmt$(sp),shape:sh?sh.i+' '+sh.n:''});}
// ---------- ▶ the backhoe review ----------
// ---------- ▶ the chaos monkey review ----------
// Every trench and cable is cut in turn, routed by compute() so the traffic visibly moves; a gold site losing HQ stops
// the review with the cut still on the map, until the next edit.
function arStop(quiet){const sh=UI.arShow;if(sh&&sh.t)clearTimeout(sh.t);UI.arShow=null;if(!S||!S.links)return;let any=false;for(const l of S.links)if(l.cut){l.cut=0;any=true;}
function arStop(quiet){mkStop();const sh=UI.arShow;if(sh&&sh.t)clearTimeout(sh.t);UI.arShow=null;if(!S||!S.links)return;let any=false;for(const l of S.links)if(l.cut){l.cut=0;any=true;}
if(UI.arFail){UI.arFail=null;any=true;}if(any&&!quiet)compute();}
function arShowStart(){if(!arOn()||UI.arShow)return;const e=arEval();if(!e.ready){toast(esc(e.why),'bad');sfx('err');return;}
arStop(true);UI.sel=null;closeModal();UI.arBaseGot=arGot();UI.arShow={units:[...new Set(S.links.map(pzUnit))],i:-1,t:0,dark:[],short:[]};arStep();}
arStop(true);UI.sel=null;closeModal();UI.arBaseGot=arGot();UI.arShow={units:[...new Set(S.links.map(pzUnit))],i:-1,t:0,dark:[],short:[]};mkStart(S.ar.hq);arStep();}
// One cut, routed: who goes dark, which gold sites with it, and who is still connected but short of room.
function arCut(u){const ls=S.links.filter(l=>pzUnit(l)===u);for(const l of ls)l.cut=1;compute();const dark=arDark(u);return {ls,dark,gold:dark.filter(c=>S.ar.gold.includes(c)),short:arShort(dark)};}
function arStep(){const sh=UI.arShow;if(!sh||!arOn())return;for(const l of S.links)l.cut=0;sh.i++;
if(sh.i>=sh.units.length){UI.arShow=null;compute();S.ar.passed=pzSig();renderAll();sfx('star');haptic(15);
toast(`✅ <b>${tr('architect.review_passed')}</b><br>${arLast()?tr('architect.last_brief_done'):tr('architect.next_brief_waiting')}`,'good');if(arLast())setTimeout(()=>{if(arOn()&&S.ar.passed===pzSig())arResults(true);},900);return;}
mkEnd(true);toast(`✅ <b>${tr('architect.review_passed')}</b><br>${arLast()?tr('architect.last_brief_done'):tr('architect.next_brief_waiting')}`,'good');if(arLast())setTimeout(()=>{if(arOn()&&S.ar.passed===pzSig())arResults(true);},900);return;}
const u=sh.units[sh.i],{ls,dark,gold,short}=arCut(u),l0=ls[0],got=arGot();sh.dark=dark;sh.short=short;sh.u=u;
floater((CITY[l0.a].x+CITY[l0.a].x+wrapDx(CITY[l0.a].x,CITY[l0.b].x))/2,(CITY[l0.a].y+CITY[l0.b].y)/2-26,l0.sub?tr('architect.anchor'):tr('architect.backhoe'),'#FF8A3D');
for(const c of dark)floater(CITY[c].x,CITY[c].y-34,gold.includes(c)?'💥 '+CITY[c].name:tr('architect.city_goes_dark',{city:CITY[c].name}),gold.includes(c)?'#FF4D5E':'#9AA3BE');
for(const c of short)floater(CITY[c].x,CITY[c].y-34,tr('architect.city_short_g',{city:CITY[c].name,g:arG(arDem(c)-(got[c]||0))}),'#FF4D5E');
const bad=gold.length||short.length;sfx(bad?'err':'click');
const bad=gold.length||short.length;mkRun(l0,dark.length?AR_STEP*1.6:AR_STEP,bad);sfx(bad?'err':'click');
if(bad){UI.arShow=null;UI.arFail={u,gold,dark,short};renderAll();haptic(30);return;}
renderAll();sh.t=setTimeout(arStep,dark.length?AR_STEP*1.6:AR_STEP);}
// Skip the show: check every cut at once, and stop at the first that breaks a gold site.

View file

@ -12,7 +12,7 @@ function arRender(el){const A=S.ar,run=arRun(),b=arBrief(),e=arEval(),sh=UI.arSh
for(const c of S.pz.avoid)h+=`<div class="arline ${S.pops[c]?'bad':'ok'}">🚫 ${tr('architect.closed_city',{city:nm(c)})}</div>`;
const T=e.tubes;if(T.max!=null)h+=`<div class="artubes${T.over?' over':''}"><span>${tr('architect.tubes_this_brief')}</span><b>${'●'.repeat(Math.min(T.u,T.max))}${'○'.repeat(Math.max(0,T.max-T.u))}${T.over?` <em>${tr('architect.n_over_plan',{n:T.over})}</em>`:''}</b></div>`;
h+=`<div class="pzbud"><div class="kv"><span>${tr('architect.spent_x_of_y',{x:fmt$(e.spend),y:fmt$(e.budget)})}</span><b>${e.cheap?'⭐':'☆'}</b></div><div class="bar ${e.cheap?(e.spend>e.budget*0.9?'warn':''):'bad'}"><i style="width:${Math.min(100,e.spend/e.budget*100).toFixed(1)}%"></i></div>${A.sunk?`<div class="meta">${tr('architect.x_paid_for_and_gone',{x:fmt$(A.sunk)})}</div>`:''}</div>`;
if(sh)h+=`<div class="arrev on">🚜 ${tr('architect.cut_n_of_m',{n:sh.i+1,m:sh.units.length})}${sh.dark.length?`<br><small>${tr('architect.dark_list',{list:sh.dark.map(nm).join(', ')})}</small>`:''}</div>`;
if(sh)h+=`<div class="arrev on">🐒 ${tr('architect.cut_n_of_m',{n:sh.i+1,m:sh.units.length})}${sh.dark.length?`<br><small>${tr('architect.dark_list',{list:sh.dark.map(nm).join(', ')})}</small>`:''}</div>`;
else if(f)h+=`<div class="arrev bad">💥 ${f.gold.length?tr('architect.cut_on_x_cuts_off_y',{x:pzUnitName(f.u),y:f.gold.map(nm).join(', ')}):tr('architect.cut_on_x_no_room',{x:pzUnitName(f.u),y:f.short.map(nm).join(', ')})}<br><small>${tr('architect.fix_it_and_send_it_again')}</small></div>`;
else if(e.passed)h+=`<div class="arrev ok">✅ ${tr('architect.review_passed')}</div>`;
else if(!e.ready)h+=`<div class="arrev">${esc(e.why)}</div>`;

View file

@ -86,6 +86,7 @@ function drawFrame(now){
CM.off=new Set();CM.big=new Set();for(const o of S.offers){const big=BIZ_T[o.type].lv>=3||BIZ_T[o.type].event;for(const c of bCities(o)){CM.off.add(c);if(big)CM.big.add(c);}}
CM.inc=new Set(S.inc.filter(i=>i.type!=='leak').map(i=>i.ref));CM.far=farL;
if(pzOn()){for(const v of vis.slice().reverse())pzDrawCity(v,sc,now);if(S.ar)for(const v of vis)arDrawTags(v,sc);}else for(const v of vis.slice().reverse())drawCity(v.C,v.sx,v.sy,sc,now,v.ly);
if(UI.mk)mkDraw(ks);
// floaters
for(let i=FLOATS.length-1;i>=0;i--){const f=FLOATS[i],a=(now-f.t)/1600;if(a>1){FLOATS.splice(i,1);continue;}
for(const k of ks){const [sx,sy]=toS(f.x,f.y,k);ctx.globalAlpha=1-a*a;ctx.font='800 17px "Baloo 2", sans-serif';ctx.textAlign='center';ctx.textBaseline='middle';ctx.lineWidth=4;ctx.strokeStyle='#fff';ctx.strokeText(f.text,sx,sy-a*40);ctx.fillStyle=f.col;ctx.fillText(f.text,sx,sy-a*40);ctx.globalAlpha=1;}}

View file

@ -0,0 +1,35 @@
/* ---------- the chaos monkey: Architect's review, as a monkey running round the map ----------
It hops from cut to cut, sprays chaos where it snips, and dances on the spot that breaks a mission-critical site.
Pure decoration on the animation clock: the review's result never depends on it, and with animations off the monkey
just sits at the cut. */
const MK_RUN=0.62; // share of a review step the monkey spends running to the next cut
const MK_COLS=['#FF4F9A','#FFD23F','#22C47A','#2F8CFF','#FF8A3D','#7B61FF'];
// Where a link's middle is, in world coordinates (the shorter way round the date line).
const mkMid=l=>[(CITY[l.a].x+CITY[l.a].x+wrapDx(CITY[l.a].x,CITY[l.b].x))/2,(CITY[l.a].y+CITY[l.b].y)/2];
function mkStart(c){const C=CITY[c];UI.mk={x:C.x,y:C.y,fx:C.x,fy:C.y,tx:C.x,ty:C.y,t0:animT,dur:1,face:1,mood:'run',spray:[],sprayAt:null,bad:false};}
// Off to the next cut: arrive, then spray.
function mkRun(l,dur,bad){const m=UI.mk;if(!m)return;const [x,y]=mkMid(l);m.fx=m.x;m.fy=m.y;m.tx=x;m.ty=y;m.t0=animT;m.dur=Math.max(1,dur*MK_RUN);
m.face=wrapDx(m.fx,x)<0?-1:1;m.mood='run';m.sprayAt=animT+m.dur;m.bad=!!bad;if(!animOn()){m.x=x;m.y=y;}}
function mkSpray(m){for(let i=0;i<(m.bad?26:16);i++){const a=Math.PI*2*i/(m.bad?26:16)+((i*37)%10)/10,v=0.05+((i*53)%10)/180;
m.spray.push({x:m.tx,y:m.ty,vx:Math.cos(a)*v,vy:Math.sin(a)*v-0.06,c:m.bad?(i%3?'#FF4D5E':'#FFD23F'):MK_COLS[i%MK_COLS.length],t:animT,s:i%4===0?(m.bad?'💥':'✂️'):null});}}
// The review is over: a cheer when everything held, a tantrum where it broke.
function mkEnd(ok){const m=UI.mk;if(!m)return;m.mood=ok?'cheer':'dance';m.t0=animT;}
function mkStop(){UI.mk=null;}
function mkDraw(ks){const m=UI.mk;if(!m)return;
const p=Math.min(1,(animT-m.t0)/m.dur),e=p<0.5?2*p*p:1-Math.pow(-2*p+2,2)/2;
if(m.mood==='run'){m.x=m.fx+wrapDx(m.fx,m.tx)*e;m.y=m.fy+(m.ty-m.fy)*e;}
if(m.sprayAt!=null&&animT>=m.sprayAt){m.sprayAt=null;if(animOn())mkSpray(m);m.mood=m.bad?'dance':'snip';m.t0=animT;}
const sz=Math.round(36*Math.max(0.85,Math.min(1.4,Math.sqrt(cam.z))));
// Hops while running, bounces on the spot otherwise.
const hop=m.mood==='run'&&p<1?Math.abs(Math.sin((animT-m.t0)/70))*sz*0.45:m.mood==='dance'?Math.abs(Math.sin((animT-m.t0)/90))*sz*0.6:m.mood==='cheer'?Math.abs(Math.sin((animT-m.t0)/120))*sz*0.35:0;
ctx.save();ctx.textAlign='center';ctx.textBaseline='middle';
for(let i=m.spray.length-1;i>=0;i--){const q=m.spray[i],a=(animT-q.t)/900;if(a>1){m.spray.splice(i,1);continue;}
const dt=animT-q.t,wx=q.x+q.vx*dt/cam.z,wy=q.y+(q.vy*dt+0.00012*dt*dt)/cam.z;
for(const k of ks){const [sx,sy]=toS(wx,wy,k);ctx.globalAlpha=1-a;if(q.s){ctx.font=`${Math.round(sz*0.7)}px sans-serif`;ctx.fillText(q.s,sx,sy);}else{ctx.fillStyle=q.c;ctx.beginPath();ctx.arc(sx,sy,Math.max(2,sz*0.13*(1-a*0.5)),0,Math.PI*2);ctx.fill();}}}
ctx.globalAlpha=1;ctx.font=`${sz}px sans-serif`;
for(const k of ks){const [sx,sy]=toS(m.x,m.y,k);ctx.save();ctx.translate(sx,sy-sz*0.7-hop);
const tilt=m.mood==='snip'?Math.sin((animT-m.t0)/60)*0.35:m.mood==='dance'?Math.sin((animT-m.t0)/80)*0.5:0;ctx.rotate(tilt);ctx.scale(m.face,1);
ctx.fillStyle='rgba(30,38,64,.18)';ctx.beginPath();ctx.ellipse(0,sz*0.62+hop,sz*0.38,sz*0.12,0,0,Math.PI*2);ctx.fill();
// Emoji take the fill's alpha, so reset it after the shadow.
ctx.fillStyle='#000';ctx.fillText('🐒',0,0);if(m.mood==='cheer')ctx.fillText('🎉',sz*0.7,-sz*0.5);ctx.restore();}
ctx.restore();}

View file

@ -23,7 +23,7 @@ function mapHidden(){for(const id of ['dashCard','bankCard']){const c=$(id);if(c
a second anyway, and every frame while the land picture is still catching up with a zoom. */
const FRAME=[];
function mapStill(t,now){const sl=UI.sel,dr=UI.drag;
const v=[t,cam.x,cam.y,cam.z,CW,CH,DPR,S,R,S&&S.day,S&&S.links.length,S&&S.offers.length,S&&S.inc.length,sl&&sl.type,sl&&sl.id,UI.hover,UI.snap&&UI.snap.id,dr&&dr.mode,dr&&dr.cx,dr&&dr.cy,FLOATS.length];
const v=[t,cam.x,cam.y,cam.z,CW,CH,DPR,S,R,S&&S.day,S&&S.links.length,S&&S.offers.length,S&&S.inc.length,sl&&sl.type,sl&&sl.id,UI.hover,UI.snap&&UI.snap.id,dr&&dr.mode,dr&&dr.cx,dr&&dr.cy,FLOATS.length,UI.mk&&UI.mk.tx,UI.mk&&UI.mk.mood];
let same=v.length===FRAME.length;for(let i=0;i<v.length;i++)if(FRAME[i]!==v[i]){same=false;FRAME[i]=v[i];}
return same&&now-(UI.drawnAt||0)<1000&&!!(WL.cv&&WL.key===(cam.z*DPR).toFixed(4)&&wlCovers(cam.z));}
function tickErr(e){console.error('[tubes] tick failed',e);if(UI.tickErr)return;UI.tickErr=true;track('tick_error',true);

View file

@ -13,9 +13,9 @@
"action_helpers.too_far_even_at_its_slowest":"Too far even at its slowest setting: an optical span here is {span} km and it reaches {max} km. Add a regen site (Line system).",
"action_helpers.unlocks_at_customer_level_n":"Unlocks at customer level {n}.",
"actions.your_router_can_t_take_a":"<b>Your router can't take a {port} port.</b><br>Upgrade it in the Infra tab.",
"architect.anchor":"⚓ Anchor!",
"architect.anchor":"🐒 Splash!",
"architect.architect_runs":"Architect runs",
"architect.backhoe":"🚜 Backhoe!",
"architect.backhoe":"🐒 Snip!",
"architect.best_n_briefs":"best: {n} briefs",
"architect.brief_n_of_m":"Brief {n} of {m}",
"architect.briefs_done":"Briefs done",
@ -43,7 +43,7 @@
"architect.euro_run":"Euro Run",
"architect.euro_run_joke":"Six briefs, one landlord, one very nervous bank.",
"architect.finish_the_run":"Finish the run",
"architect.fix_it_and_send_it_again":"Fix it, then send the backhoe again.",
"architect.fix_it_and_send_it_again":"Fix it, then let the chaos monkey loose again.",
"architect.from_x":"from {x}",
"architect.gold_lead":"Mission-critical: this site must stay connected to HQ whichever single trench or cable is cut, and the detour needs room for its traffic.",
"architect.gold_must_survive":"Must survive any single cut: {list}",
@ -57,7 +57,7 @@
"architect.lay_a_tube_to":"Lay a tube to",
"architect.line_1":"It works. Finance would like a word.",
"architect.line_2":"Solid design, a little gold plated. Finance can live with it.",
"architect.line_3":"At par or better. The backhoe went home bored.",
"architect.line_3":"At par or better. The chaos monkey went home bored.",
"architect.move_out_of_city":"Move out of {city} first.",
"architect.n_briefs":"{n} briefs",
"architect.n_over_plan":"{n} over plan",
@ -78,8 +78,8 @@
"architect.pacific_rim":"Pacific Rim",
"architect.pacific_rim_joke":"Oceans, anchors and very expensive glass.",
"architect.plus_router_x":"+ bigger router {x}",
"architect.ready_no_gold_yet":"Ready. Nothing is mission-critical yet, so the backhoe can only make a mess.",
"architect.ready_send_the_backhoe":"Ready. Send the backhoe and see what survives.",
"architect.ready_no_gold_yet":"Ready. Nothing is mission-critical yet, so the chaos monkey can only make a mess.",
"architect.ready_send_the_backhoe":"Ready. Let the chaos monkey loose and see what survives.",
"architect.reset_brief":"Reset brief",
"architect.review_passed":"Review passed",
"architect.ring_list":"One ring through {list}",
@ -87,8 +87,8 @@
"architect.router_x":"Router: {x}",
"architect.run_complete":"Run complete",
"architect.run_over":"Run over",
"architect.runs_lead":"One network, built brief by brief. Your build carries over, and a backhoe checks every design: cut any one tube, and everything still connected must get all its traffic.",
"architect.send_the_backhoe":"Send the backhoe",
"architect.runs_lead":"One network, built brief by brief. Your build carries over, and a chaos monkey tests every design: it cuts one tube at a time, and everything still connected must get all its traffic.",
"architect.send_the_backhoe":"Let the chaos monkey loose",
"architect.shape_braces":"Belt and braces",
"architect.shape_full":"Full mesh",
"architect.shape_islands":"Islands",

View file

@ -1,4 +1,4 @@
// Architect runs (prototype): one network built brief by brief, reviewed by a backhoe.
// Architect runs (prototype): one network built brief by brief, reviewed by a chaos monkey.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
@ -34,7 +34,7 @@ test('architect runs: every reference passes each brief, on plan and within budg
assert.deepEqual(errors, []);
});
test('architect runs: the backhoe finds a shared trench, edits clear the cut, old builds are paid for', () => {
test('architect runs: the chaos monkey finds a shared trench, edits clear the cut, old builds are paid for', () => {
const { ev, errors } = load();
ev("ACT.pzArStart({id:'euro'})");
assert.equal(ev("arHide('lis')&&arHide('bru')"), true, 'cities outside the run are hidden');