From 4edd760ff64bcacb29483beca4e71e937a8774d6 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sat, 31 Oct 2026 07:25:57 +0100 Subject: [PATCH] Puzzle list: each section counts its own stars (#231) The 'Your stars' box at the top counted only the puzzle packs, yet sat above the architect runs and the weekly puzzle. It moves right above the packs as 'Stars from the packs' (what unlocks the next pack), and the architect runs header shows its own total like a pack does. Weekly rows already show their stars. One label renamed in all six languages. --- 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/95-modals/95-puzzles.js | 3 ++- src/game/95-modals/96-architect.js | 2 +- src/i18n/en.js | 2 +- tests/architect.test.js | 17 +++++++++++++++++ 10 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac76186..2cb27fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- The puzzle list counts each section's own stars: architect runs show theirs next to their title, and the pack total now sits right above the packs, the stars that unlock the next one (#231). - Premium submarine terminals and Optical engineering can no longer be bought on a cable where they would change nothing (#198). The button now says so, and an upgrade that only helps together with the other one stays available. - A wave size that is sold out on a route can no longer be reached by upgrading a smaller wave on it (#201). The upgrade button says how long it is sold out, just like when buying. - Choosing Both for a PNI with one member now really splits it: the second member arrives in the other building when the augment lands, instead of joining the first (#219). diff --git a/site/i18n/de.js b/site/i18n/de.js index 64a42ff..e24fad2 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3147,6 +3147,7 @@ "puzzles.small_networks_real_traffic":"Kleine Netze, echter Traffic", "puzzles.spent_x":"Ausgegeben {x}", "puzzles.spent_x_of_y":"Ausgegeben {x} / {y}", +"puzzles.stars_from_the_packs":"Sterne aus den Paketen", "puzzles.stepping_stone_optional":"Trittstein (optional)", "puzzles.suez_you_later":"Suez bald", "puzzles.survive_any_single_cut_with_the":"Überleb jeden einzelnen Schnitt, und der Traffic fließt weiter. Verbunden sein reicht nicht.", @@ -3172,7 +3173,6 @@ "puzzles.with_the_pop_price":"mit POP: {price}", "puzzles.your_pop":"Dein POP", "puzzles.your_routers_pick_the_path":"Deine Router wählen den Weg. Sag ihnen welchen: Metriken, niedrigste Latenz, Best Effort.", -"puzzles.your_stars":"Deine Sterne", "puzzles.your_stars_so_far":"Deine Sterne bisher", "puzzles_weekly.detour":"Umleitung", "puzzles_weekly.island_hopping":"Inselhüpfen", diff --git a/site/i18n/es.js b/site/i18n/es.js index 13aeff7..1e49aab 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3145,6 +3145,7 @@ "puzzles.small_networks_real_traffic":"Redes pequeñas, tráfico de verdad", "puzzles.spent_x":"Gastado {x}", "puzzles.spent_x_of_y":"Gastado {x} / {y}", +"puzzles.stars_from_the_packs":"Estrellas de los packs", "puzzles.stepping_stone_optional":"Escala (opcional)", "puzzles.suez_you_later":"Suez luego", "puzzles.survive_any_single_cut_with_the":"Sobrevive a cualquier corte, con el tráfico todavía fluyendo. Estar conectado no basta.", @@ -3170,7 +3171,6 @@ "puzzles.with_the_pop_price":"con el POP: {price}", "puzzles.your_pop":"Tu POP", "puzzles.your_routers_pick_the_path":"Tus routers eligen el camino. Diles cuál: métricas, menor latencia, best effort.", -"puzzles.your_stars":"Tus estrellas", "puzzles.your_stars_so_far":"Tus estrellas hasta ahora", "puzzles_weekly.detour":"Desvío", "puzzles_weekly.island_hopping":"De isla en isla", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 93e7fa7..a46b221 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3145,6 +3145,7 @@ "puzzles.small_networks_real_traffic":"Petits réseaux, vrai trafic", "puzzles.spent_x":"Dépensé {x}", "puzzles.spent_x_of_y":"Dépensé {x} / {y}", +"puzzles.stars_from_the_packs":"Étoiles des packs", "puzzles.stepping_stone_optional":"Escale (facultative)", "puzzles.suez_you_later":"Suez la prochaine", "puzzles.survive_any_single_cut_with_the":"Survis à n'importe quelle coupure, avec le trafic qui passe toujours. Être connecté ne suffit pas.", @@ -3170,7 +3171,6 @@ "puzzles.with_the_pop_price":"avec le POP : {price}", "puzzles.your_pop":"Ton POP", "puzzles.your_routers_pick_the_path":"Tes routeurs choisissent le chemin. Dis-leur lequel : métriques, latence minimale, best effort.", -"puzzles.your_stars":"Tes étoiles", "puzzles.your_stars_so_far":"Tes étoiles pour l'instant", "puzzles_weekly.detour":"Détour", "puzzles_weekly.island_hopping":"Saut d’île en île", diff --git a/site/i18n/it.js b/site/i18n/it.js index 512cb33..802274c 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3145,6 +3145,7 @@ "puzzles.small_networks_real_traffic":"Reti piccole, traffico vero", "puzzles.spent_x":"Speso {x}", "puzzles.spent_x_of_y":"Speso {x} / {y}", +"puzzles.stars_from_the_packs":"Stelle dai pacchetti", "puzzles.stepping_stone_optional":"Tappa (facoltativa)", "puzzles.suez_you_later":"Suez la prossima", "puzzles.survive_any_single_cut_with_the":"Sopravvivi a qualsiasi taglio, con il traffico che scorre ancora. Essere collegati non basta.", @@ -3170,7 +3171,6 @@ "puzzles.with_the_pop_price":"con il POP: {price}", "puzzles.your_pop":"Il tuo POP", "puzzles.your_routers_pick_the_path":"I tuoi router scelgono il percorso. Digli quale: metriche, latenza minima, best effort.", -"puzzles.your_stars":"Le tue stelle", "puzzles.your_stars_so_far":"Le tue stelle finora", "puzzles_weekly.detour":"Deviazione", "puzzles_weekly.island_hopping":"Di isola in isola", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index ec25f9d..f391933 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3145,6 +3145,7 @@ "puzzles.small_networks_real_traffic":"Redes pequenas, tráfego de verdade", "puzzles.spent_x":"Gasto {x}", "puzzles.spent_x_of_y":"Gasto {x} / {y}", +"puzzles.stars_from_the_packs":"Estrelas dos pacotes", "puzzles.stepping_stone_optional":"Escala (opcional)", "puzzles.suez_you_later":"Suez mais tarde", "puzzles.survive_any_single_cut_with_the":"Sobreviva a qualquer corte, com o tráfego ainda fluindo. Estar conectado não basta.", @@ -3170,7 +3171,6 @@ "puzzles.with_the_pop_price":"com o POP: {price}", "puzzles.your_pop":"Seu POP", "puzzles.your_routers_pick_the_path":"Seus routers escolhem o caminho. Diga qual: métricas, menor latência, best effort.", -"puzzles.your_stars":"Suas estrelas", "puzzles.your_stars_so_far":"Suas estrelas até agora", "puzzles_weekly.detour":"Desvio", "puzzles_weekly.island_hopping":"De ilha em ilha", diff --git a/src/game/95-modals/95-puzzles.js b/src/game/95-modals/95-puzzles.js index 645160b..933a6f1 100644 --- a/src/game/95-modals/95-puzzles.js +++ b/src/game/95-modals/95-puzzles.js @@ -128,10 +128,11 @@ function pzMenu(){pzWkEnsure();const p=pzLoad(),tot=pzStarsTotal(p),max=PZ.lengt

${tr('puzzles.no_clock_no_bills_real_traffic')}

`; // Once, after the puzzles got traffic: the old stars are kept on the wall, the new set starts at zero. if(p.old&&!p.noted){h+=`
🖼️ ${tr('puzzles.puzzles_got_traffic_note',{n:p.old})}
`;p.noted=1;pzStore(p);} - h+=`
${tr('puzzles.your_stars')}⭐ ${tot} / ${max}
${nxP?`
${tr('puzzles.next_pack_unlocks_at_n',{n:nxP.need,pack:esc(nxP.n)})}
`:''}${p.old?`
🖼️ ${tr('puzzles.framed_n_stars_from_the_old',{n:p.old})}
`:''}
`; if(pzOn())h+=`
${(UI.pzTop||0)>0&&(UI.pzTop||0)<3?btn(tr('puzzles.finish_here'),'pzFinish',{},'sm'):''}${btn(UI.pzFrom==='game'?tr('puzzles.back_to_my_network'):tr('puzzles.back_to_the_title'),'pzLeave',{},'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}
`; h+=arMenuRows(); h+=pzWkRow(); + // The packs' own total, right above them: it is what unlocks the next pack (#231). Runs and weeklies count their own. + h+=`
${tr('puzzles.stars_from_the_packs')}⭐ ${tot} / ${max}
${nxP?`
${tr('puzzles.next_pack_unlocks_at_n',{n:nxP.need,pack:esc(nxP.n)})}
`:''}${p.old?`
🖼️ ${tr('puzzles.framed_n_stars_from_the_old',{n:p.old})}
`:''}
`; for(const pk of PZ_PACKS){const open=tot>=pk.need,got=PZ.filter(x=>x.pack===pk.id).reduce((a,x)=>a+((p.s[x.id]||{}).st|0),0),n=PZ.filter(x=>x.pack===pk.id).length; h+=`

${open?'':'🔒 '}${esc(pk.n)} ⭐ ${got}/${n*3}

${open?esc(pk.d):tr('puzzles.unlocks_at_n_stars',{n:pk.need})}

`; for(const d of PZ.filter(x=>x.pack===pk.id)){const r=p.s[d.id],tg=pzDemTag(d); diff --git a/src/game/95-modals/96-architect.js b/src/game/95-modals/96-architect.js index 1eb9c7c..42412e3 100644 --- a/src/game/95-modals/96-architect.js +++ b/src/game/95-modals/96-architect.js @@ -75,7 +75,7 @@ function arResults(done){const A=S.ar,run=arRun(),sp=arSpend(),br=done?run.brief
${nx&&done?btn(tr('architect.next_run')+' →','pzArStart',{id:nx.id},'pink big'):btn(tr('puzzles.more_puzzles'),'puzzleMenu',{},'pink big')}${btn(tr('architect.try_again'),'pzRetry',{},'')}${done?btn(tr('common.share_2cd9'),'pzShare',{},'ghost'):btn(tr('architect.keep_going'),'closeModal',{},'ghost')}
`); for(let i=0;i{sfx('star');haptic(15);},i*450+150);if(st>=3)setTimeout(()=>sfx('fanfare'),3*450+250);} // ---------- the list ---------- -function arMenuRows(){const p=arLoad();let h=`

🏗️ ${tr('architect.architect_runs')} ${tr('architect.new')}

${tr('architect.runs_lead')}

`;arWkEnsure();h+=arWkRow(); +function arMenuRows(){const p=arLoad(),got=AR_RUNS.reduce((a,r)=>a+((p.runs[r.id]||{}).st|0),0);let h=`

🏗️ ${tr('architect.architect_runs')} ⭐ ${got}/${AR_RUNS.length*3} ${tr('architect.new')}

${tr('architect.runs_lead')}

`;arWkEnsure();h+=arWkRow(); for(const r of AR_RUNS){const x=p.runs[r.id]; h+=`
${esc(r.n)} ${pzStarStr(x?x.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)})}${x&&x.sp!=null?' · '+tr('puzzles.best_x',{x:fmt$(x.sp)}):x&&x.br?' · '+tr('architect.best_n_briefs',{n:x.br}):''}
${btn(tr('common.play'),'pzArStart',{id:r.id},x&&x.st>=3?'ghost':'pink')}
`;} return h;} diff --git a/src/i18n/en.js b/src/i18n/en.js index ec710fd..c457b5c 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3146,6 +3146,7 @@ "puzzles.small_networks_real_traffic":"Small networks, real traffic", "puzzles.spent_x":"Spent {x}", "puzzles.spent_x_of_y":"Spent {x} / {y}", +"puzzles.stars_from_the_packs":"Stars from the packs", "puzzles.stepping_stone_optional":"Stepping stone (optional)", "puzzles.suez_you_later":"Suez You Later", "puzzles.survive_any_single_cut_with_the":"Survive any single cut, with the traffic still flowing. Connected is not enough.", @@ -3171,7 +3172,6 @@ "puzzles.with_the_pop_price":"with the POP: {price}", "puzzles.your_pop":"Your POP", "puzzles.your_routers_pick_the_path":"Your routers pick the path. Tell them which: metrics, lowest latency, best effort.", -"puzzles.your_stars":"Your stars", "puzzles.your_stars_so_far":"Your stars so far", "puzzles_weekly.detour":"Detour", "puzzles_weekly.island_hopping":"Island hopping", diff --git a/tests/architect.test.js b/tests/architect.test.js index 40d4498..a487aba 100644 --- a/tests/architect.test.js +++ b/tests/architect.test.js @@ -163,3 +163,20 @@ test('architect runs: the map tells two tubes in one trench from two separate pa assert.deepEqual(JSON.parse(ev("JSON.stringify(AR_PILLS.map(p=>p[2]).sort())")), ['2× one trench', '✓ 2 paths']); assert.deepEqual(errors, []); }); + +test('#231 the puzzle list counts each section\'s own stars: runs above, packs next to the packs', () => { + const { ev, errors } = load(); + // 2 stars on a pack puzzle, 2 on Euro Run, 3 on another run + ev("localStorage.setItem(PZ_KEY,JSON.stringify({set:PZ_SET,noted:1,s:{[PZ[0].id]:{st:2}}}));localStorage.setItem(AR_KEY,JSON.stringify({runs:{[AR_RUNS[0].id]:{st:2},[AR_RUNS[1].id]:{st:3}}}))"); + ev('ACT.puzzleMenu()'); + const heads = JSON.parse(ev("JSON.stringify([...document.querySelectorAll('#modal h3.pzpack')].map(h=>h.textContent))")); + assert.match(heads[0], new RegExp(`Architect runs ⭐ 5/${3 * ev('AR_RUNS.length')}`), heads[0]); + // the packs' total sits right above the first pack, after the runs and the weekly puzzle, and says what it counts + const order = ev(`(()=>{const m=document.querySelector('#modal'),box=m.querySelector('.pzprog'),run=m.querySelector('[data-act=pzArStart]'),pack=[...m.querySelectorAll('h3.pzpack')].find(h=>!h.textContent.includes('🏗️')); + return [!!(run.compareDocumentPosition(box)&Node.DOCUMENT_POSITION_FOLLOWING),!!(box.compareDocumentPosition(pack)&Node.DOCUMENT_POSITION_FOLLOWING),box.textContent].join('|')})()`); + const [afterRuns, beforePacks, box] = order.split('|'); + assert.equal(afterRuns, 'true', 'below the architect runs'); + assert.equal(beforePacks, 'true', 'above the first pack'); + assert.match(box, new RegExp(`Stars from the packs⭐ 2 / ${3 * ev('PZ.length')}`), box); + assert.deepEqual(errors, []); +});