diff --git a/.claude/skills/gameplay-rules/SKILL.md b/.claude/skills/gameplay-rules/SKILL.md index 99ea7eb..ad7c362 100644 --- a/.claude/skills/gameplay-rules/SKILL.md +++ b/.claude/skills/gameplay-rules/SKILL.md @@ -55,7 +55,7 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one | C1 | Every scenario has a name, a goal, an `ok()` its progress card (`SCN_PROG`) shows, and cannot be won on day 0; so does every committed weekly scenario (`site/scenarios/weekly/`, its goal type's card in `WS_GOALS`). | A goal must need play. | | C2 | Every puzzle has a 1-star and a 3-star reference solution in `REF` of `tests/puzzles.test.js`, which builds and scores them. | Every puzzle is solvable and every star reachable. | | C3 | Every player-facing string is translated in every language (`node scripts/i18n-check.js`: 0 missing, 0 unused, 0 broken). | CLAUDE.md; see `add-strings`. | -| C4 | Every Architect run, handmade (`REF` in `tests/architect.test.js`) or weekly (`ref` in its file, `scripts/weekly-architect.js --check`), has a reference build that passes every brief's chaos monkey review and earns three stars; every weekly brief takes at least one tube, and later briefs' cities stay hidden until they come. | A run you cannot finish, or a brief that asks for nothing, is not a puzzle; knowing the next brief makes it a chore. | +| C4 | Every Architect run, handmade (`REF` in `tests/architect.test.js`) or weekly (`ref` in its file, `scripts/weekly-architect.js --check`), has a reference build that passes every brief's chaos monkey review and earns three stars; every weekly brief takes at least one change (a tube, a bigger tube, a move), and later briefs' cities stay hidden until they come. | A run you cannot finish, or a brief that asks for nothing, is not a puzzle; knowing the next brief makes it a chore. | ## Fun and fairness diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d59bb4..cb1bb2c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ All notable changes to this project are documented here. The project follows ## [2.0.0] — 2026-10-29 -- A new Architect run every week: every Sunday a fresh HQ somewhere in the world and six or seven briefs, each built around the network you already have, with its own stars. Later briefs stay a surprise in every Architect run: their cities only appear when they come. +- A new Architect run every week: every Sunday a fresh HQ somewhere in the world and six or seven briefs, each built around the network you already have, with its own stars. Sites can outgrow their tubes, so some briefs are about making room. Later briefs stay a surprise in every Architect run: their cities only appear when they come. - In puzzles, the map now shows whether the tubes between two cities share one trench or take separate paths, at any zoom: one trench is drawn as a bundle with a "2× one trench" tag, separate paths bow apart with a "2 paths" tag. - Every puzzle now has the chaos monkey: when your build earns a new star, it runs round the map snipping each trench and cable in turn, and the cities that lose traffic say how much. Let it loose again whenever you like, or skip straight to the stars. - A chaos monkey now and then moves into your network in On-call and BGP at 3 a.m., and snips a tube every couple of weeks for 120 to 240 days, tubes with no backup path first. Its snips replace the usual random outages while it is here; get through the visit without a customer noticing for a resilience bonus and a new badge, or throw it a banana to send it home early. The "Met the Backhoe" badge is now "Met the Chaos Monkey", earned on its first visit; badges you already have stay yours. diff --git a/scripts/weekly-architect.js b/scripts/weekly-architect.js index e3dd253..1e916be 100644 --- a/scripts/weekly-architect.js +++ b/scripts/weekly-architect.js @@ -23,7 +23,7 @@ const path = require('node:path'); const { game, world } = require('./weekly-puzzle'); const ROOT = path.join(__dirname, '..'); -const SCHEMA = 1, HISTORY = 4, ATTEMPTS = 40, DEM_MAX = 100; +const SCHEMA = 1, HISTORY = 4, ATTEMPTS = 40, DEM_MAX = 380; const NAMES = ['architect_weekly.name_all_roads_lead_to_hq', 'architect_weekly.name_the_hq_job', 'architect_weekly.name_hq_and_friends']; const JOKES = ['architect_weekly.joke_hq_signed_the_lease', 'architect_weekly.joke_one_network_a_handful']; @@ -40,13 +40,35 @@ const J = (ev, code) => JSON.parse(ev(`JSON.stringify(${code})`)); function stage(ev, key, hq, briefs) { ev(`UI.arWk={key:'${key}',def:{id:arWkId('${key}'),key:'${key}',wk:true,n:'',j:'',hq:'${hq}',via:[],budget:2e7,briefs:${JSON.stringify(briefs)},rev:1},at:Date.now()}`); } -// Lay one tube the way a player does: a diverse trench when the pair already has one overland. -function lay(ev, a, b, via) { +// Lay one tube the way a player does: a diverse trench when the pair already has one overland. The size is what all +// the traffic needs (100G, or 400G once there is more than 100G), smaller where a long cable cannot take it. +const tierFor = (ev) => (ev('S.pz.cities.reduce((a,c)=>a+(c===S.ar.hq?0:arDem(c)),0)') > 100 ? 2 : 1); +function lay(ev, a, b, via, tier) { if (!ev(`!!S.pops['${a}']`)) [a, b] = [b, a]; const n = ev('S.links.length'); - ev(`ACT.pzLinkTo({a:'${a}',b:'${b}'});ACT.pzVia({v:'${via}'});ACT.pzDiv({v:1});ACT.pzLink({tier:AR_TIER});closeModal()`); - if (ev('S.links.length') !== n + 1) throw new Error(`could not lay ${a}-${b} ${via}`); - return [a, b, via]; + for (let t = tier == null ? tierFor(ev) : tier; t >= 0; t--) { + ev(`ACT.pzLinkTo({a:'${a}',b:'${b}'});ACT.pzVia({v:'${via}'});ACT.pzDiv({v:1});ACT.pzLink({tier:${t}});closeModal()`); + if (ev('S.links.length') === n + 1) return [a, b, via, t]; + if (tier != null) break; + } + throw new Error(`could not lay ${a}-${b} ${via}`); +} +// One step of a reference, as the file keeps it: a tube [a, b, route, size], ['@rm', city] closing a POP, or +// ['@tier', n, size] resizing the n-th tube. +function step(ev, s) { + if (s[0] === '@rm') { ev(`ACT.pzRmPop({city:'${s[1]}'})`); return; } + if (s[0] === '@tier') { const n = ev(`(()=>{const l=S.links[${s[1]}];ACT.pzTier({id:l.id,tier:${s[2]}});return S.links[${s[1]}].tier;})()`); if (n !== s[2]) throw new Error(`could not resize tube ${s[1]}`); return; } + lay(ev, s[0], s[1], s[2], s[3]); +} +// Room for the traffic: upsize the busiest tube that is not cut (or, when it cannot grow, lay a second one beside it). +function makeRoom(ev, W, steps, cut) { + const ls = J(ev, `(()=>{${cut ? `for(const l of S.links)if(pzUnit(l)===${JSON.stringify(cut)})l.cut=1;` : ''}compute();const o=S.links.map((l,i)=>({i,a:l.a,b:l.b,cut:!!l.cut,tier:l.tier,u:(R.load[l.id]||0)/capOf(l)})).filter(x=>!x.cut).sort((x,y)=>y.u-x.u);for(const l of S.links)l.cut=0;compute();return o;})()`); + for (const l of ls.slice(0, 3)) { + if (l.tier < 2) { const t = ev(`(()=>{const l=S.links[${l.i}];ACT.pzTier({id:l.id,tier:${l.tier + 1}});return S.links[${l.i}].tier;})()`); if (t === l.tier + 1) { steps.push(['@tier', l.i, t]); return; } } + const o = W.opts(l.a, l.b).filter((x) => !x.second).sort((x, y) => x.cost - y.cost)[0]; + if (o) { try { steps.push(lay(ev, o.a, o.b, o.via)); return; } catch (e) { /* try the next tube */ } } + } + throw new Error('no room to be made'); } // What the review would say: the first cut that strands a mission-critical site or leaves a site short. const reviewFail = (ev) => J(ev, `(()=>{let f=null;for(const u of [...new Set(S.links.map(pzUnit))]){const x=arCut(u);for(const l of x.ls)l.cut=0;if(x.gold.length||x.short.length){f={u,gold:x.gold,short:x.short,dark:x.dark};break;}}compute();return f;})()`); @@ -64,9 +86,9 @@ function solveBrief(ev, W, steps) { if (rg) { const cs = rg.cs, has = J(ev, 'S.links.map(l=>edgeKey(l))'); let done = false; for (let i = 0; i < cs.length && !done; i++) { const a = cs[i], b = cs[(i + 1) % cs.length]; if (has.includes(ev(`edgeKey({a:'${a}',b:'${b}'})`))) continue; const o = best([a], [b]); if (o) { steps.push(lay(ev, o.a, o.b, o.via)); done = true; } } if (!done) throw new Error('ring out of reach'); continue; } - if (!e.ready) throw new Error(`not ready: ${e.why}`); + if (!e.ready) { if (/thin/i.test(e.why) || J(ev, 'arEval().sites.some(s=>!s.full)')) { makeRoom(ev, W, steps, null); continue; } throw new Error(`not ready: ${e.why}`); } const f = reviewFail(ev); if (!f) return; - if (f.short.length) throw new Error('short of capacity'); + if (f.short.length && !f.gold.length) { makeRoom(ev, W, steps, f.u); continue; } // A cut strands a mission-critical site: join the stranded side to the rest another way. const rest = J(ev, `Object.keys(S.pops).filter(c=>!${JSON.stringify(f.dark)}.includes(c))`), o = best(f.dark, rest, f.u); if (!o) throw new Error('no second way'); steps.push(lay(ev, o.a, o.b, o.via)); @@ -88,6 +110,8 @@ function design(kind, ev, W, r, s) { const ms = Math.min(...os.map((x) => x.ms)), cap = Math.ceil(ms * 1.12 * 10) / 10; if (cap < 2 || cap >= cur * 0.85) continue; if (!bestP || cur / cap > bestP.k) bestP = { a, b, cap, k: cur / cap }; } if (!bestP) return null; s.lat = [bestP.a, bestP.b]; return { lat: [bestP.a, bestP.b, bestP.cap] }; } + if (kind === 'grow') { const cs = pops.filter((c) => c !== hq).map((c) => [c, ev(`arDem('${c}')`)]).sort((x, y) => y[1] - x[1]); if (!cs.length || s.room < 60) return null; + const [c, d] = cs[0], g = d + Math.min(s.room, pick(r, [60, 90, 120])); s.room -= g - d; return { dem: { [c]: g } }; } if (kind === 'ring') { const cs = pops.filter((c) => c !== hq).sort((a, b) => W.km(hq, a) - W.km(hq, b)).slice(0, 2); if (cs.length < 2) return null; const ring = [hq, ...cs]; if (ev(`arRingOk(${JSON.stringify(ring)})`)) return null; return { ring }; } return null; @@ -102,14 +126,14 @@ function play(g, W, key, hq, plan, r, sites) { if (plan[i] === 'add1') b = first(); else if (plan[i] === 'add2') { if (s.todo.length < 2) throw new Error('not enough sites'); const a = s.todo.shift(), c = s.todo.shift(), ga = Math.min(s.room, 20); s.room -= ga; const gc = Math.min(s.room, pick(r, [10, 20])); s.room -= gc; b = { add: [a, c], dem: { [a]: ga, [c]: gc } }; } // A kind that cannot be made here gives way to one the run has not had yet, then to a new mission-critical site. - else for (const k of [plan[i], ...['lat', 'ring', 'move', 'gold'].filter((x) => !plan.slice(0, i).includes(x) && x !== plan[i]), 'addgold']) { b = design(k, ev, W, r, s); if (b) { plan[i] = k; break; } } + else for (const k of [plan[i], ...['lat', 'ring', 'move', 'grow', 'gold'].filter((x) => !plan.slice(0, i).includes(x) && x !== plan[i]), 'addgold']) { b = design(k, ev, W, r, s); if (b) { plan[i] = k; break; } } if (!b) throw new Error(`brief ${i + 1}: nothing left to ask`); b.tubes = 9; briefs.push(b); stage(ev, key, hq, briefs.map((x) => Object.assign({ t: '' }, x))); if (i === 0) ev(`ACT.pzArStart({id:arWkId('${key}')})`); else ev('ACT.pzArNext()'); if (ev('S.ar.bi') !== i) throw new Error(`brief ${i + 1} did not start`); const st = []; solveBrief(ev, W, st); steps.push(st); b.tubes = ev('S.links.filter(l=>(l.br|0)===S.ar.bi).length'); - if (!b.tubes) throw new Error(`brief ${i + 1} needs no tube`); + if (!st.length) throw new Error(`brief ${i + 1} asks for nothing new`); ev(`UI.arWk.def.briefs[${i}].tubes=${b.tubes}`); if (!passes(ev)) throw new Error(`brief ${i + 1}: the review does not pass`); } @@ -125,7 +149,7 @@ function verify(g, j, key) { ev(`UI.arWk={key:'${key}',def:arWkValid(${JSON.stringify(j)},'${key}'),at:Date.now()}`); ev(`ACT.pzArStart({id:arWkId('${key}')})`); for (let i = 0; i < def.briefs.length; i++) { - for (const st of j.ref.steps[i]) if (st[0] === '@rm') ev(`ACT.pzRmPop({city:'${st[1]}'})`); else lay(ev, st[0], st[1], st[2]); + for (const st of j.ref.steps[i]) step(ev, st); if (!passes(ev)) return { ok: false, why: `brief ${i + 1} does not pass` }; if (i < def.briefs.length - 1) ev('ACT.pzArNext()'); } @@ -146,7 +170,7 @@ function generate(g, key, dir) { const hq = pick(r, hqs).id; const near = W.cities.filter((c) => c.id !== hq && c.reg === W.C[hq].reg && W.km(hq, c.id) < 2500).sort((a, b) => W.km(hq, a.id) - W.km(hq, b.id)).slice(0, 8).map((c) => c.id); if (near.length < 6) continue; - const mid = shuffle(r, ['lat', 'ring', 'move', 'addgold']).slice(0, r() < 0.5 ? 2 : 3); + const mid = shuffle(r, ['lat', 'ring', 'move', 'addgold', 'grow']).slice(0, r() < 0.5 ? 2 : 3); const plan = ['add1', 'add2', 'gold', ...mid, 'gold']; const sites = [...near.slice(0, 3), ...shuffle(r, near.slice(3))]; try { @@ -191,9 +215,9 @@ function refresh(g, dir, now = Date.now()) { } const writeIndex = (dir) => fs.writeFileSync(path.join(dir, 'index.json'), JSON.stringify({ v: SCHEMA, weeks: list(dir) }) + '\n'); const writeWeek = (dir, j) => { fs.mkdirSync(dir, { recursive: true }); fs.writeFileSync(path.join(dir, j.key + '.json'), JSON.stringify(j) + '\n'); writeIndex(dir); }; -const say = (j) => `${j.key}: HQ ${j.hq}, ${j.briefs.length} briefs (${j.briefs.map((b) => Object.keys(b).filter((k) => k !== 'tubes' && k !== 'dem').join('+')).join(', ')}), budget ${j.budget}, reference ${j.ref.spend}`; +const say = (j) => `${j.key}: HQ ${j.hq}, ${j.briefs.length} briefs (${j.briefs.map((b) => Object.keys(b).filter((k) => k !== 'tubes' && (k !== 'dem' || !b.add)).map((k) => (k === 'dem' ? 'grow' : k)).join('+')).join(', ')}), budget ${j.budget}, reference ${j.ref.spend}`; -module.exports = { generate, verify, check, refresh, writeWeek, writeIndex, list, say }; +module.exports = { generate, verify, check, refresh, writeWeek, writeIndex, list, say, step }; if (require.main === module) { const args = process.argv.slice(2), opt = (n, d) => { const i = args.indexOf(n); return i >= 0 ? args[i + 1] : d; }; diff --git a/site/architect/weekly/2026-W44.json b/site/architect/weekly/2026-W44.json index fd5f6ed..18ecb43 100644 --- a/site/architect/weekly/2026-W44.json +++ b/site/architect/weekly/2026-W44.json @@ -1 +1 @@ -{"v":1,"key":"2026-W44","hq":"cor","budget":1160000,"name":{"l":"architect_weekly.name_all_roads_lead_to_hq","p":{"hq":"cor"}},"joke":{"l":"architect_weekly.joke_hq_signed_the_lease","p":{"hq":"cor"}},"briefs":[{"add":["bue"],"dem":{"bue":20},"tubes":1},{"add":["scl","mvd"],"dem":{"scl":20,"mvd":20},"tubes":2},{"gold":["mvd"],"tubes":2},{"ring":["cor","bue","scl"],"tubes":1},{"add":["cgr"],"dem":{"cgr":20},"gold":["cgr"],"tubes":2},{"lat":["cgr","cor",11.3],"tubes":1}],"ref":{"spend":1090844,"steps":[[["cor","bue","land"]],[["cor","scl","land"],["bue","mvd","land"]],[["bue","cor","land"],["mvd","bue","land"]],[["scl","bue","land"]],[["bue","cgr","land"],["cgr","bue","land"]],[["cgr","cor","land"]]]}} +{"v":1,"key":"2026-W44","hq":"cor","budget":1580000,"name":{"l":"architect_weekly.name_all_roads_lead_to_hq","p":{"hq":"cor"}},"joke":{"l":"architect_weekly.joke_hq_signed_the_lease","p":{"hq":"cor"}},"briefs":[{"add":["bue"],"dem":{"bue":40},"tubes":1},{"add":["scl","mvd"],"dem":{"scl":20,"mvd":20},"tubes":2},{"gold":["mvd"],"tubes":2},{"drop":["scl"],"add":["ldb"],"dem":{"ldb":10},"gold":["ldb"],"tubes":2},{"lat":["ldb","mvd",10.1],"tubes":1},{"dem":{"bue":100},"tubes":0},{"add":["cgr"],"dem":{"cgr":10},"gold":["cgr"],"tubes":2}],"ref":{"spend":1489176,"steps":[[["cor","bue","land",1]],[["cor","scl","land",1],["bue","mvd","land",1]],[["bue","cor","land",1],["mvd","bue","land",1]],[["@rm","scl"],["cor","ldb","land",1],["ldb","cor","land",1]],[["ldb","mvd","land",1]],[["@tier",2,2],["@tier",0,2]],[["ldb","cgr","land",2],["cgr","ldb","land",2]]]}} diff --git a/site/architect/weekly/2026-W45.json b/site/architect/weekly/2026-W45.json index ea2b841..0ebd073 100644 --- a/site/architect/weekly/2026-W45.json +++ b/site/architect/weekly/2026-W45.json @@ -1 +1 @@ -{"v":1,"key":"2026-W45","hq":"maa","budget":920000,"name":{"l":"architect_weekly.name_hq_and_friends","p":{"hq":"maa"}},"joke":{"l":"architect_weekly.joke_one_network_a_handful","p":{}},"briefs":[{"add":["blr"],"dem":{"blr":20},"tubes":1},{"add":["hyd","cbo"],"dem":{"hyd":20,"cbo":20},"tubes":2},{"gold":["cbo"],"tubes":1},{"ring":["maa","blr","hyd"],"tubes":1},{"drop":["hyd"],"add":["mle"],"dem":{"mle":30},"gold":["mle"],"tubes":2},{"gold":["blr"],"tubes":1}],"ref":{"spend":860936,"steps":[[["maa","blr","land"]],[["blr","hyd","land"],["maa","cbo","smw6"]],[["cbo","maa","smw4"]],[["hyd","maa","land"]],[["@rm","hyd"],["cbo","mle","smw6"],["mle","maa","iax"]],[["blr","maa","land"]]]}} +{"v":1,"key":"2026-W45","hq":"maa","budget":930000,"name":{"l":"architect_weekly.name_hq_and_friends","p":{"hq":"maa"}},"joke":{"l":"architect_weekly.joke_one_network_a_handful","p":{}},"briefs":[{"add":["blr"],"dem":{"blr":30},"tubes":1},{"add":["hyd","cbo"],"dem":{"hyd":20,"cbo":20},"tubes":2},{"gold":["cbo"],"tubes":1},{"ring":["maa","blr","hyd"],"tubes":1},{"drop":["hyd"],"add":["dac"],"dem":{"dac":20},"gold":["dac"],"tubes":2},{"gold":["blr"],"tubes":1}],"ref":{"spend":869628,"steps":[[["maa","blr","land",1]],[["blr","hyd","land",1],["maa","cbo","smw6",1]],[["cbo","maa","smw4",1]],[["hyd","maa","land",1]],[["@rm","hyd"],["maa","dac","land",1],["dac","maa","land",1]],[["blr","maa","land",1]]]}} diff --git a/site/architect/weekly/2026-W46.json b/site/architect/weekly/2026-W46.json index a047c0e..446e87a 100644 --- a/site/architect/weekly/2026-W46.json +++ b/site/architect/weekly/2026-W46.json @@ -1 +1 @@ -{"v":1,"key":"2026-W46","hq":"svg","budget":570000,"name":{"l":"architect_weekly.name_hq_and_friends","p":{"hq":"svg"}},"joke":{"l":"architect_weekly.joke_one_network_a_handful","p":{}},"briefs":[{"add":["krs"],"dem":{"krs":40},"tubes":1},{"add":["osl","ebj"],"dem":{"osl":20,"ebj":10},"tubes":2},{"gold":["ebj"],"tubes":2},{"lat":["osl","svg",2.2],"tubes":1},{"drop":["krs"],"add":["ams"],"dem":{"ams":20},"gold":["ams"],"tubes":4},{"ring":["svg","osl","ebj"],"tubes":1},{"add":["edi"],"dem":{"edi":10},"gold":["edi"],"tubes":2}],"ref":{"spend":534112,"steps":[[["svg","krs","land"]],[["krs","osl","land"],["krs","ebj","land"]],[["krs","svg","land"],["ebj","krs","land"]],[["osl","svg","land"]],[["@rm","krs"],["ebj","svg","land"],["ebj","ams","land"],["ebj","svg","land"],["ams","ebj","land"]],[["ebj","osl","land"]],[["svg","edi","nouk"],["edi","ebj","havh"]]]}} +{"v":1,"key":"2026-W46","hq":"svg","budget":610000,"name":{"l":"architect_weekly.name_the_hq_job","p":{"hq":"svg"}},"joke":{"l":"architect_weekly.joke_one_network_a_handful","p":{}},"briefs":[{"add":["krs"],"dem":{"krs":30},"tubes":1},{"add":["osl","ebj"],"dem":{"osl":20,"ebj":20},"tubes":2},{"gold":["ebj"],"tubes":2},{"lat":["osl","svg",2.2],"tubes":1},{"drop":["krs"],"add":["cph"],"dem":{"cph":20},"gold":["cph"],"tubes":3},{"dem":{"osl":140},"tubes":0}],"ref":{"spend":567292,"steps":[[["svg","krs","land",1]],[["krs","osl","land",1],["krs","ebj","land",1]],[["krs","svg","land",1],["ebj","krs","land",1]],[["osl","svg","land",1]],[["@rm","krs"],["ebj","svg","land",1],["ebj","cph","land",1],["cph","osl","land",1]],[["@tier",0,2],["@tier",1,2],["@tier",2,2],["@tier",3,2]]]}} diff --git a/site/i18n/de.js b/site/i18n/de.js index e2c5eae..102b491 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -128,12 +128,15 @@ "architect_weekly.name_all_roads_lead_to_hq":"Alle Wege führen nach {hq}", "architect_weekly.name_hq_and_friends":"{hq} und Freunde", "architect_weekly.name_the_hq_job":"Der {hq}-Job", +"architect_weekly.next_run_in_d_h":"neuer Run in {d} T {h} Std.", +"architect_weekly.next_run_in_h_m":"neuer Run in {h} Std. {m} Min.", "architect_weekly.t_add_gold":"{a} ist neu dabei und von Tag eins an geschäftskritisch: muss jeden einzelnen Schnitt überstehen.", "architect_weekly.t_add_one":"{a} ist neu dabei: anschließen.", "architect_weekly.t_add_two":"{a} und {b} sind neu dabei: anschließen.", "architect_weekly.t_drop":"{a} schließt: zieh aus und bau dort nicht wieder.", "architect_weekly.t_gold_one":"{a} ist jetzt geschäftskritisch: muss jeden einzelnen Schnitt überstehen.", "architect_weekly.t_gold_two":"{a} und {b} sind jetzt geschäftskritisch: müssen jeden einzelnen Schnitt überstehen.", +"architect_weekly.t_grow":"{a} wächst auf {g}: schaff Platz.", "architect_weekly.t_lat":"{a} ⇄ {b} muss unter {ms} ms bleiben.", "architect_weekly.t_ring":"{list} wollen auf einem Ring liegen.", "architect_weekly.weekly_run":"Architect-Run der Woche", diff --git a/site/i18n/es.js b/site/i18n/es.js index 5376911..a7a695c 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -126,12 +126,15 @@ "architect_weekly.name_all_roads_lead_to_hq":"Todos los caminos llevan a {hq}", "architect_weekly.name_hq_and_friends":"{hq} y amigos", "architect_weekly.name_the_hq_job":"El golpe de {hq}", +"architect_weekly.next_run_in_d_h":"nueva ronda en {d} d {h} h", +"architect_weekly.next_run_in_h_m":"nueva ronda en {h} h {m} min", "architect_weekly.t_add_gold":"{a} se apunta, crítico desde el primer día: debe sobrevivir a cualquier corte.", "architect_weekly.t_add_one":"{a} se apunta: conéctalo.", "architect_weekly.t_add_two":"{a} y {b} se apuntan: conéctalos.", "architect_weekly.t_drop":"{a} cierra: múdate y no vuelvas a construir allí.", "architect_weekly.t_gold_one":"{a} es ahora crítico: debe sobrevivir a cualquier corte.", "architect_weekly.t_gold_two":"{a} y {b} son ahora críticos: deben sobrevivir a cualquier corte.", +"architect_weekly.t_grow":"{a} crece hasta {g}: haz sitio.", "architect_weekly.t_lat":"{a} ⇄ {b} debe quedarse por debajo de {ms} ms.", "architect_weekly.t_ring":"{list} quieren estar en un mismo anillo.", "architect_weekly.weekly_run":"La ronda de Arquitecto de la semana", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 4fbd868..5f2e28a 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -126,12 +126,15 @@ "architect_weekly.name_all_roads_lead_to_hq":"Tous les chemins mènent à {hq}", "architect_weekly.name_hq_and_friends":"{hq} et ses amis", "architect_weekly.name_the_hq_job":"Le coup de {hq}", +"architect_weekly.next_run_in_d_h":"nouveau parcours dans {d} j {h} h", +"architect_weekly.next_run_in_h_m":"nouveau parcours dans {h} h {m} min", "architect_weekly.t_add_gold":"{a} signe, critique dès le premier jour : il doit survivre à n’importe quelle coupure.", "architect_weekly.t_add_one":"{a} signe : raccorde-le.", "architect_weekly.t_add_two":"{a} et {b} signent : raccorde-les.", "architect_weekly.t_drop":"{a} ferme : déménage et ne construis plus là-bas.", "architect_weekly.t_gold_one":"{a} est désormais critique : il doit survivre à n’importe quelle coupure.", "architect_weekly.t_gold_two":"{a} et {b} sont désormais critiques : ils doivent survivre à n’importe quelle coupure.", +"architect_weekly.t_grow":"{a} passe à {g} : fais de la place.", "architect_weekly.t_lat":"{a} ⇄ {b} doit rester sous {ms} ms.", "architect_weekly.t_ring":"{list} veulent être sur un même anneau.", "architect_weekly.weekly_run":"Le parcours d’architecte de la semaine", diff --git a/site/i18n/it.js b/site/i18n/it.js index c21f57c..cc4b4fe 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -126,12 +126,15 @@ "architect_weekly.name_all_roads_lead_to_hq":"Tutte le strade portano a {hq}", "architect_weekly.name_hq_and_friends":"{hq} e amici", "architect_weekly.name_the_hq_job":"Il colpo di {hq}", +"architect_weekly.next_run_in_d_h":"nuovo percorso tra {d} g {h} h", +"architect_weekly.next_run_in_h_m":"nuovo percorso tra {h} h {m} min", "architect_weekly.t_add_gold":"{a} si iscrive, critico dal primo giorno: deve sopravvivere a qualsiasi taglio.", "architect_weekly.t_add_one":"{a} si iscrive: collegalo.", "architect_weekly.t_add_two":"{a} e {b} si iscrivono: collegali.", "architect_weekly.t_drop":"{a} chiude: trasloca e non costruire più lì.", "architect_weekly.t_gold_one":"{a} ora è critico: deve sopravvivere a qualsiasi taglio.", "architect_weekly.t_gold_two":"{a} e {b} ora sono critici: devono sopravvivere a qualsiasi taglio.", +"architect_weekly.t_grow":"{a} cresce fino a {g}: fai spazio.", "architect_weekly.t_lat":"{a} ⇄ {b} deve restare sotto {ms} ms.", "architect_weekly.t_ring":"{list} vogliono stare su un unico anello.", "architect_weekly.weekly_run":"Il percorso da architetto della settimana", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 3782ca0..bc3cd3a 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -126,12 +126,15 @@ "architect_weekly.name_all_roads_lead_to_hq":"Todos os caminhos levam a {hq}", "architect_weekly.name_hq_and_friends":"{hq} e amigos", "architect_weekly.name_the_hq_job":"O golpe de {hq}", +"architect_weekly.next_run_in_d_h":"nova rodada em {d} d {h} h", +"architect_weekly.next_run_in_h_m":"nova rodada em {h} h {m} min", "architect_weekly.t_add_gold":"{a} entrou, crítico desde o primeiro dia: precisa sobreviver a qualquer corte.", "architect_weekly.t_add_one":"{a} entrou: conecte-o.", "architect_weekly.t_add_two":"{a} e {b} entraram: conecte-os.", "architect_weekly.t_drop":"{a} vai fechar: saia de lá e não construa lá de novo.", "architect_weekly.t_gold_one":"{a} agora é crítico: precisa sobreviver a qualquer corte.", "architect_weekly.t_gold_two":"{a} e {b} agora são críticos: precisam sobreviver a qualquer corte.", +"architect_weekly.t_grow":"{a} cresce para {g}: abra espaço.", "architect_weekly.t_lat":"{a} ⇄ {b} precisa ficar abaixo de {ms} ms.", "architect_weekly.t_ring":"{list} querem ficar no mesmo anel.", "architect_weekly.weekly_run":"A rodada de Arquiteto da semana", diff --git a/src/game/60-features/98-architect-weekly.js b/src/game/60-features/98-architect-weekly.js index f345fdd..d7a00d0 100644 --- a/src/game/60-features/98-architect-weekly.js +++ b/src/game/60-features/98-architect-weekly.js @@ -20,6 +20,7 @@ function arWkSay(b){const n=c=>CITY[c].name,t=[]; if(ag)t.push(tr('architect_weekly.t_add_gold',{a:n(b.add[0])})); else if(b.add)t.push(b.add.length>1?tr('architect_weekly.t_add_two',{a:n(b.add[0]),b:n(b.add[1])}):tr('architect_weekly.t_add_one',{a:n(b.add[0])})); if(b.gold&&!ag)t.push(b.gold.length>1?tr('architect_weekly.t_gold_two',{a:n(b.gold[0]),b:n(b.gold[1])}):tr('architect_weekly.t_gold_one',{a:n(b.gold[0])})); + for(const c of Object.keys(b.dem||{}))if(!(b.add||[]).includes(c))t.push(tr('architect_weekly.t_grow',{a:n(c),g:arG(b.dem[c])})); if(b.ring)t.push(tr('architect_weekly.t_ring',{list:b.ring.map(n).join(', ')})); if(b.lat)t.push(tr('architect_weekly.t_lat',{a:n(b.lat[0]),b:n(b.lat[1]),ms:+b.lat[2].toFixed(1)})); return t.join(' ');} @@ -34,7 +35,7 @@ function arWkBriefs(a,hq){if(!Array.isArray(a)||a.length<3||a.length>7)return nu const dem={};if(b.dem!=null){if(!pzObj(b.dem))return null;for(const c of Object.keys(b.dem)){const g=b.dem[c];if(!sites.has(c)||c===hq||!Number.isInteger(g)||g<10||g>400)return null;dem[c]=g;}} let lat=null;if(b.lat!=null){const l=b.lat;if(!Array.isArray(l)||l.length!==3||!sites.has(l[0])||!sites.has(l[1])||l[0]===l[1]||typeof l[2]!=='number'||!isFinite(l[2])||l[2]<1||l[2]>300)return null;lat=l.slice();} if(!Number.isInteger(b.tubes)||b.tubes<0||b.tubes>9)return null; - if(!add.length&&!gold.length&&!ring.length&&!lat)return null; + if(!add.length&&!gold.length&&!ring.length&&!lat&&!Object.keys(dem).length)return null; const o={tubes:b.tubes};if(add.length)o.add=add;if(gold.length)o.gold=gold;if(ring.length)o.ring=ring;if(drop.length)o.drop=drop;if(Object.keys(dem).length)o.dem=dem;if(lat)o.lat=lat; o.t=arWkSay(o);out.push(o);} return out[0].add?out:null;} @@ -56,4 +57,7 @@ function arWkEnsure(){const key=pzWeekKey(new Date()),w=UI.arWk;if(w&&w.key===ke // Its row in the Puzzles menu, above the handmade runs; nothing while there is none. function arWkRow(){const w=UI.arWk,r=w&&w.key===pzWeekKey(new Date())?w.def:null;if(!r)return '
'; const x=arLoad().runs[r.id],ok=x&&(x.rv||1)===r.rev?x:null; - return `
🗓️ ${tr('architect_weekly.weekly_run')}
${esc(r.n)} ${pzStarStr(ok?ok.st:0)}
${esc(r.j)}
${tr('architect.n_briefs',{n:r.briefs.length})} · 🏠 ${esc(CITY[r.hq].name)} · ${tr('puzzles.budget_x',{x:fmt$(r.budget)})}${ok&&ok.sp!=null?' · '+tr('puzzles.best_x',{x:fmt$(ok.sp)}):''}
${btn(tr('common.play'),'pzArStart',{id:r.id},ok&&ok.st>=3?'ghost':'pink')}
`;} + return `
🗓️ ${tr('architect_weekly.weekly_run')} · ${arWkNext(new Date())}
${esc(r.n)} ${pzStarStr(ok?ok.st:0)}
${esc(r.j)}
${tr('architect.n_briefs',{n:r.briefs.length})} · 🏠 ${esc(CITY[r.hq].name)} · ${tr('puzzles.budget_x',{x:fmt$(r.budget)})}${ok&&ok.sp!=null?' · '+tr('puzzles.best_x',{x:fmt$(ok.sp)}):''}
${btn(tr('common.play'),'pzArStart',{id:r.id},ok&&ok.st>=3?'ghost':'pink')}
`;} +// "New run in 2 d 14 h": when next week's run comes out. +function arWkNext(now){const t=pzWeekStart(pzKeyAdd(pzWeekKey(now),1))-now,m=Math.max(1,Math.ceil(t/60e3)),d=Math.floor(m/1440),h=Math.floor(m%1440/60); + return d?tr('architect_weekly.next_run_in_d_h',{d,h}):tr('architect_weekly.next_run_in_h_m',{h,m:m%60});} diff --git a/src/i18n/en.js b/src/i18n/en.js index e0a4100..4df1db5 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -127,12 +127,15 @@ "architect_weekly.name_all_roads_lead_to_hq":"All Roads Lead to {hq}", "architect_weekly.name_hq_and_friends":"{hq} and Friends", "architect_weekly.name_the_hq_job":"The {hq} Job", +"architect_weekly.next_run_in_d_h":"new run in {d} d {h} h", +"architect_weekly.next_run_in_h_m":"new run in {h} h {m} min", "architect_weekly.t_add_gold":"{a} signs up, mission-critical from day one: it must survive any single cut.", "architect_weekly.t_add_one":"{a} signs up: connect it.", "architect_weekly.t_add_two":"{a} and {b} sign up: connect them.", "architect_weekly.t_drop":"{a} is closing: move out, and don’t build there again.", "architect_weekly.t_gold_one":"{a} is now mission-critical: it must survive any single cut.", "architect_weekly.t_gold_two":"{a} and {b} are now mission-critical: they must survive any single cut.", +"architect_weekly.t_grow":"{a} grows to {g}: make room.", "architect_weekly.t_lat":"{a} ⇄ {b} must stay under {ms} ms.", "architect_weekly.t_ring":"{list} want to sit on one ring.", "architect_weekly.weekly_run":"This week’s Architect run", diff --git a/tests/weekly-architect.test.js b/tests/weekly-architect.test.js index 42aca52..916ba41 100644 --- a/tests/weekly-architect.test.js +++ b/tests/weekly-architect.test.js @@ -16,12 +16,28 @@ test('the generator makes the same run for the same week, and its reference earn const g = game(), a = AW.generate(g, '2026-W50', tmp()), b = AW.generate(g, '2026-W50', tmp()); assert.deepEqual(a, b, 'deterministic'); assert.ok(a.briefs.length >= 6 && a.briefs.length <= 7); - assert.ok(a.briefs.every((x) => x.tubes >= 1), 'every brief asks for at least one tube'); + assert.ok(a.ref.steps.every((st) => st.length >= 1), 'every brief asks for a change: a tube, a bigger tube or a move'); assert.ok(a.briefs.some((x) => x.gold), 'something is mission-critical'); assert.ok(a.budget >= a.ref.spend && a.budget <= a.ref.spend * 1.1 + 10000, 'the budget sits just above the reference'); assert.equal(AW.verify(g, a, '2026-W50').ok, true); }); +test('a grow brief makes the reference make room: a bigger tube or a second one', () => { + const g = game(), d = tmp(), runs = ['2026-W47', '2026-W49', '2026-W53'].map((k) => AW.generate(g, k, d)); + const grows = runs.flatMap((j) => j.briefs.map((b, i) => [j, b, i]).filter(([, b]) => b.dem && !b.add)); + assert.ok(grows.length >= 1, 'some weeks grow a site'); + for (const [j, b, i] of grows) { + const [c, gb] = Object.entries(b.dem)[0]; + assert.ok(gb > 100 || j.briefs.slice(0, i).some((x) => x.dem && x.dem[c] && x.dem[c] < gb), 'the site really grows'); + assert.ok(j.ref.steps[i].length >= 1, 'and that brief takes a change'); + } + const { ev } = load(); + const [j, b] = grows[0]; + ev(`UI.arWk={key:'${j.key}',def:arWkValid(${JSON.stringify(j)},'${j.key}'),at:Date.now()}`); + const c = Object.keys(b.dem)[0]; + assert.ok(ev(`UI.arWk.def.briefs.some(x=>x.t.includes(CITY['${c}'].name+' grows to'))`), 'the brief says so'); +}); + test('every published week is accepted and its reference still earns three stars', () => { const keys = AW.list(DIR); assert.ok(keys.length >= 3); @@ -59,7 +75,7 @@ test('this week\'s run shows in Puzzles, plays like a handmade one and keeps its assert.equal(ev(`arHide('${j.briefs[1].add[0]}')`), true, 'the next brief\'s cities stay hidden'); // The reference, played through: three stars, stored under the week, and no handmade run offered as "next". j.ref.steps.forEach((st, i) => { - for (const s of st) if (s[0] === '@rm') ev(`ACT.pzRmPop({city:'${s[1]}'})`); else ev(`ACT.pzLinkTo({a:'${s[0]}',b:'${s[1]}'});ACT.pzVia({v:'${s[2]}'});ACT.pzDiv({v:1});ACT.pzLink({tier:AR_TIER});closeModal()`); + for (const s of st) AW.step(ev, s); ev('arShowStart();arShowSkip()'); assert.ok(ev('S.ar.passed===pzSig()'), `brief ${i + 1} passes`); ev('ACT.pzArNext()');