From 729506416789d7057a7c1b8320fe79f8d88a92af Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Wed, 4 Nov 2026 14:46:34 +0100 Subject: [PATCH] Architect: a diverse tube takes the cheapest other route, and the detour message names every site (closes #282) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The diverse button picked the first other cable listed, which on Amsterdam–London is the dearest, so the Euro Run's plain plan ended at $416k against a $410k budget. --- CHANGELOG.md | 1 + site/i18n/de.js | 2 +- site/i18n/es.js | 2 +- site/i18n/fr.js | 2 +- site/i18n/it.js | 2 +- site/i18n/pt.js | 2 +- src/game/90-actions/95-puzzles.js | 3 ++- src/i18n/en.js | 2 +- tests/architect.test.js | 24 ++++++++++++++++++++++++ 9 files changed, 33 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f44c82..3124f77 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- In Architect runs, a diverse second tube now takes the cheapest other route, as a new tube does, so the Euro Run's plain plan fits its budget again. A failed review also says that every site still connected after a cut needs room for its traffic, not only the mission-critical ones (#282). - A new button next to the speed controls opens a NOC screen in a window of its own, to keep on a second display beside the map. It is a dark wallboard with a live world map of your links and POPs, traffic and money graphs, alarms, and your hottest ports with their upgrade buttons, which work on the running game; click a POP to see its ports. Details has the full dashboard, and Full screen fills the display. The new window only shows and sends clicks: your network is still played and saved in the game window. Phones do not show the button. - Cities of one country on one piece of land can be joined by fiber over land, even where there is no road: Pevek to Anadyr or Moscow, Juneau to Seattle, Nuuk to Sisimiut. Inside one country, crossing from Europe into Asia (Moscow–Vladivostok, Istanbul–Ankara) is no longer priced as a crossing between continents. - No circuit of any kind can be built between North and South Korea, and nothing leaves South Korea over land: every way out is a subsea cable. diff --git a/site/i18n/de.js b/site/i18n/de.js index 29d9a85..f3c590a 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -37,7 +37,7 @@ "architect.coast_to_coast_joke":"Von der Data Center Alley bis ins Silicon Valley, ein Auftrag nach dem anderen.", "architect.cut_n_of_m":"Schnitt {n} von {m}…", "architect.cut_on_x_cuts_off_y":"Ein Schnitt auf {x} schneidet {y} ab.", -"architect.cut_on_x_no_room":"Ein Schnitt auf {x} lässt auf dem Umweg keinen Platz. Es fehlt: {y}.", +"architect.cut_on_x_no_room":"Ein Schnitt auf {x} lässt auf dem Umweg keinen Platz. Es fehlt: {y}. Jeder Standort, der nach einem Schnitt noch verbunden ist, braucht Platz für seinen ganzen Verkehr, ob geschäftskritisch oder nicht.", "architect.dark_list":"Vorerst offline: {list}. Nicht geschäftskritisch, also ist das erlaubt.", "architect.drag_from_your_hq":"Zieh von deinem HQ zu einer anderen Stadt, um eine Röhre zu legen", "architect.euro_1":"Deine Server stehen in Amsterdam. Erster Kunde: Frankfurt. Schließ ihn an.", diff --git a/site/i18n/es.js b/site/i18n/es.js index 4b0afd4..524e13d 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -35,7 +35,7 @@ "architect.coast_to_coast_joke":"Del callejón de los data centers a Silicon Valley, encargo a encargo.", "architect.cut_n_of_m":"Corte {n} de {m}…", "architect.cut_on_x_cuts_off_y":"Un corte en {x} deja aislado a {y}.", -"architect.cut_on_x_no_room":"Un corte en {x} no deja sitio en el desvío. Falta: {y}.", +"architect.cut_on_x_no_room":"Un corte en {x} no deja sitio en el desvío. Falta: {y}. Cada sitio que sigue conectado tras un corte necesita espacio para todo su tráfico, sea crítico o no.", "architect.dark_list":"A oscuras por ahora: {list}. No es crítico, así que está permitido.", "architect.drag_from_your_hq":"Arrastra desde tu sede a otra ciudad para tender un tubo", "architect.euro_1":"Tus servidores viven en Ámsterdam. Primer cliente: Fráncfort. Conéctalo.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index e272788..f24108f 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -35,7 +35,7 @@ "architect.coast_to_coast_joke":"De l’allée des data centers à la Silicon Valley, un brief à la fois.", "architect.cut_n_of_m":"Coupure {n} sur {m}…", "architect.cut_on_x_cuts_off_y":"Une coupure sur {x} isole {y}.", -"architect.cut_on_x_no_room":"Une coupure sur {x} ne laisse pas de place sur le détour. Manque : {y}.", +"architect.cut_on_x_no_room":"Une coupure sur {x} ne laisse pas de place sur le détour. Manque : {y}. Chaque site encore connecté après une coupure a besoin de place pour tout son trafic, critique ou non.", "architect.dark_list":"Éteint pour l’instant : {list}. Pas critique, donc c’est permis.", "architect.drag_from_your_hq":"Fais glisser depuis ton QG vers une autre ville pour poser un tube", "architect.euro_1":"Tes serveurs vivent à Amsterdam. Premier client : Francfort. Connecte-le.", diff --git a/site/i18n/it.js b/site/i18n/it.js index 2f107f4..64db789 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -35,7 +35,7 @@ "architect.coast_to_coast_joke":"Dal vicolo dei data center alla Silicon Valley, un incarico alla volta.", "architect.cut_n_of_m":"Taglio {n} di {m}…", "architect.cut_on_x_cuts_off_y":"Un taglio su {x} isola {y}.", -"architect.cut_on_x_no_room":"Un taglio su {x} non lascia spazio sulla deviazione. Manca: {y}.", +"architect.cut_on_x_no_room":"Un taglio su {x} non lascia spazio sulla deviazione. Manca: {y}. Ogni sito ancora collegato dopo un taglio ha bisogno di spazio per tutto il suo traffico, critico o no.", "architect.dark_list":"Al buio per ora: {list}. Non è critico, quindi si può.", "architect.drag_from_your_hq":"Trascina dalla tua sede a un’altra città per posare un tubo", "architect.euro_1":"I tuoi server vivono ad Amsterdam. Primo cliente: Francoforte. Collegalo.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index af4e427..4359045 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -35,7 +35,7 @@ "architect.coast_to_coast_joke":"Do beco dos data centers ao Vale do Silício, um pedido de cada vez.", "architect.cut_n_of_m":"Corte {n} de {m}…", "architect.cut_on_x_cuts_off_y":"Um corte em {x} isola {y}.", -"architect.cut_on_x_no_room":"Um corte em {x} não deixa espaço no desvio. Falta: {y}.", +"architect.cut_on_x_no_room":"Um corte em {x} não deixa espaço no desvio. Falta: {y}. Cada local ainda ligado depois de um corte precisa de espaço para todo o seu tráfego, seja crítico ou não.", "architect.dark_list":"No escuro por enquanto: {list}. Não é crítico, então pode.", "architect.drag_from_your_hq":"Arraste da sua sede até outra cidade para lançar um tubo", "architect.euro_1":"Seus servidores moram em Amsterdã. Primeiro cliente: Frankfurt. Conecte.", diff --git a/src/game/90-actions/95-puzzles.js b/src/game/90-actions/95-puzzles.js index e1342f7..7841e66 100644 --- a/src/game/90-actions/95-puzzles.js +++ b/src/game/90-actions/95-puzzles.js @@ -31,7 +31,8 @@ Object.assign(ACT,{ closeModal();sfx('build');haptic(12);floater((CITY[a].x+CITY[a].x+wrapDx(CITY[a].x,CITY[b].x))/2,(CITY[a].y+CITY[b].y)/2-20,S.ar?tr('architect.tube_laid'):tr('links.wave_lit',{wave:LT[tier].n}),'#FF4F9A');UI.sel=null;pzAfter();}, // Another link next to this one: the picker opens on the same pair, on the same route, in the same trench or a diverse one. pzAddPar:({id,div})=>{const l=pzOn()&&S.links.find(x=>x.id===id);if(!l)return;UI.pzVia=l.cable||'land';UI.pzDiv=!!+div;UI.pzTrench=l.cable?null:pzUnit(l); - if(+div&&l.cable){const o=pzRoutes(l.a,l.b).find(x=>x.via!==l.cable&&!(S.pz.noSub&&x.sub));if(o)UI.pzVia=o.via;} + // A diverse tube takes the cheapest other route at this tube's size, as a new tube does, not the first one listed (#282). + if(+div&&l.cable){const o=pzRoutes(l.a,l.b).filter(x=>x.via!==l.cable&&!(S.pz.noSub&&x.sub)).sort((x,y)=>pzLinkCost(x,l.tier,true)-pzLinkCost(y,l.tier,true))[0];if(o)UI.pzVia=o.via;} pzLinkModal(l.a,l.b,true);}, pzTier:({id,tier})=>{tier=+tier;const l=pzOn()&&S.links.find(x=>x.id===id);if(!l||!(S.ar?AR_TIERS:PZ_TIERS).includes(tier)||l.tier===tier)return;const why=pzWaveWhy(l.a,l.b,tier,{km:l.km,sub:l.sub});if(why){toast(esc(why),'bad');sfx('err');return;} pzSnap();if(S.ar){if(arAge(l) { + const { ev, errors } = load(); + // Each new tube takes the route the window offers; each second tube comes from the tube's own "diverse" button. + const neu = (a, b) => ev(`ACT.pzLinkTo({a:'${a}',b:'${b}'});ACT.pzLink({tier:AR_TIER});closeModal()`); + const div = (a, b) => ev(`(()=>{const l=S.links.find(x=>edgeKey(x)===edgeKey({a:'${a}',b:'${b}'}));ACT.pzAddPar({id:l.id,div:1});ACT.pzLink({tier:AR_TIER});closeModal()})()`); + ev("ACT.pzArStart({id:'euro'})"); + const briefs = [() => neu('ams', 'fra'), () => { neu('ams', 'par'); neu('ams', 'lon'); }, () => neu('par', 'fra'), () => { neu('ams', 'zrh'); neu('par', 'zrh'); }, + () => { neu('lon', 'par'); div('ams', 'lon'); }, () => { ev("ACT.pzRmPop({city:'fra'})"); neu('ams', 'dus'); div('ams', 'dus'); }]; + briefs.forEach((f, i) => { + f(); + assert.equal(review(ev), true, `brief ${i + 1}: ${ev('arEval().why')}`); + if (i === 4) { + const cost = (v) => ev(`pzLinkCost(pzRoutes('ams','lon').find(x=>x.via==='${v}'),AR_TIER,true)`); + const used = ev("S.links.filter(l=>edgeKey(l)===edgeKey({a:'ams',b:'lon'})).map(l=>l.cable).sort().join()"); + const other = used.split(',').find((v) => v !== 'nshuttle'); + for (const v of ['uly', 'circe', 'concerto']) assert.ok(cost(other) <= cost(v), `the diverse London tube is the cheapest other cable, not ${other}`); + } + if (i < briefs.length - 1) ev('ACT.pzArNext()'); + }); + assert.equal(ev('arOver()'), 0); + assert.equal(ev('arSpend()<=arRun().budget'), true, `within budget: ${ev('arSpend()')} of ${ev('arRun().budget')}`); + assert.deepEqual(errors, []); +});