Puzzles: small, calm network builds with stars, packs and a weekly puzzle (#190)

This commit is contained in:
Frederic Jung 2026-10-28 16:21:25 +01:00
parent c011022203
commit 7fc8d0f080
No known key found for this signature in database
28 changed files with 1283 additions and 23 deletions

View file

@ -2661,6 +2661,122 @@
"progress.under_attack_now":"Gerade unter Beschuss",
"progress.your_score_peak_traffic":"Dein Ergebnis: Spitzen-Traffic",
"progress.your_traffic_to_and_from_asia":"Dein Traffic von und nach Asien",
"puzzles.a_backhoe_walks_into_your_network":"Kommt ein Bagger in dein Netz. Nichts passiert.",
"puzzles.a_pop_costs_setup_plus_a_year":"Ein POP kostet {setup} Einrichtung, dann {mo}/Monat. Puzzles rechnen die Einrichtung und ein Jahr Miete.",
"puzzles.a_tiny_island_where_half_the":"Eine winzige Insel, auf der die halbe Pazifik-Verkabelung Kaffeepause macht.",
"puzzles.a_to_b_under_ms":"{a} → {b} unter {ms} ms",
"puzzles.a_to_b_under_ms_now":"{a} → {b} unter {ms} ms (jetzt {now} ms)",
"puzzles.aloha_latency":"Aloha Latenz",
"puzzles.avoid_list":"ohne {list}",
"puzzles.back_to_my_network":"Zurück zu meinem Netz",
"puzzles.back_to_the_title":"Zurück zum Startbildschirm",
"puzzles.beat_the_clock_light_in_glass":"Licht in Glasfaser schafft 200 km pro Millisekunde. Wähl deine Kabel, als ob es darauf ankäme.",
"puzzles.belt_and_braces":"Gürtel und Hosenträger",
"puzzles.best_x":"Bestwert {x}",
"puzzles.budget":"Budget",
"puzzles.budget_x":"Budget {x}",
"puzzles.connect_list":"Verbinde {list}.",
"puzzles.connected":"Verbunden",
"puzzles.copied_paste_it_anywhere":"Kopiert! Füg es irgendwo ein:<br>{t}",
"puzzles.de_kicks_sales_has_your_number":"Der DE-KICKS-Vertrieb hat deine Nummer. Verbinde Deutschland ohne Frankfurt.",
"puzzles.diverse_route_40_survives_a_backhoe":"Getrennte Trasse (+40 %, übersteht einen Bagger)",
"puzzles.down_under_up_and_running":"Down Under, up and running",
"puzzles.drag_from_a_pink_pop_to":"Zieh von einem pinken POP zu einer anderen Stadt, um eine Wave zu mieten",
"puzzles.drag_from_this_pop_onto_another":"Zieh von diesem POP auf eine andere Puzzle-Stadt oder wähl eine hier.",
"puzzles.euro_trip":"Euro-Trip",
"puzzles.every_internet_starts_with_one_tube":"Jedes Internet beginnt mit einer Röhre.",
"puzzles.every_link_n_g_or_more":"Jeder Link {n}G oder mehr",
"puzzles.fat_pipes_only":"Nur dicke Rohre",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Für Architekten, die die Baggersaison verschlafen.",
"puzzles.four_capitals_one_very_long_winter":"Vier Hauptstädte, ein sehr langer Winter, null Ausreden für Ausfälle.",
"puzzles.four_cities_four_cables_one_ring":"Vier Städte, ein Ring. Tolkien wäre begeistert, dein NOC sowieso.",
"puzzles.four_cities_one_continent_and_a":"Vier Städte, ein Kontinent und dazwischen sehr viel Mais.",
"puzzles.frankfurt_to_singapore_the_short_way":"Frankfurt nach Singapur auf dem kurzen Weg. Der lange führt über Land, und das merkt man.",
"puzzles.free":"Gratis",
"puzzles.goal":"Ziel",
"puzzles.goal_city":"Zielstadt",
"puzzles.guam_slam":"Guam Slam",
"puzzles.hello_world":"Hallo, Welt",
"puzzles.honolulu_the_world_s_most_scenic":"Honolulu: der malerischste Regenerator-Standort der Welt.",
"puzzles.includes_a_new_pop_in_city":"Mit neuem POP in {city} ({price} für ein Jahr).",
"puzzles.it_works_finance_and_the_backhoe":"Läuft! Die Buchhaltung und der Bagger hätten da noch Fragen.",
"puzzles.keep_building":"Weiterbauen",
"puzzles.kiwi_fruit_salad":"Kiwi-Obstsalat",
"puzzles.lease_a_wave_to":"Wave mieten nach",
"puzzles.more_puzzles":"Mehr Puzzles",
"puzzles.n_1_club":"N-1-Club",
"puzzles.n_1_connect_everything_first":"N-1: erst alles verbinden",
"puzzles.n_g_links":"{n}G-Links",
"puzzles.n_week_streak":{"one":"{n} Woche in Folge","other":"{n} Wochen in Folge"},
"puzzles.new_zealand_is_far_from_everything":"Neuseeland ist weit weg von allem. Genau das ist der Witz, und das Problem.",
"puzzles.next_pack_unlocks_at_n":"Nächstes Paket, {pack}, ab {n}⭐",
"puzzles.next_puzzle":"Nächstes Puzzle",
"puzzles.no_budget":"kein Budget",
"puzzles.no_budget_star_on_the_house":"kein Budget: ⭐ geht aufs Haus",
"puzzles.no_cable_lands_in_both_try":"Kein Kabel landet in {a} und {b}. Versuch es mit einem Trittstein dazwischen.",
"puzzles.no_clock_no_bills_nothing_breaks":"Keine Uhr, keine Rechnungen, nichts geht kaputt. Verbinde die Städte und hol dir drei Sterne: unter Budget, und noch verbunden, wenn irgendein Link durchtrennt wird.",
"puzzles.no_pop_in_list":"Kein POP in {list}",
"puzzles.no_subsea":"kein Seekabel",
"puzzles.no_subsea_cables":"Keine Seekabel",
"puzzles.nobody_ever_got_fired_for_buying":"Für 100G ist noch nie jemand gefeuert worden.",
"puzzles.not_this_one_find_a_way_around":"Die nicht. Such dir einen Weg drumherum.",
"puzzles.not_through_frankfurt":"Nicht über Frankfurt",
"puzzles.off_limits":"Tabu",
"puzzles.on_the_house":"Aufs Haus",
"puzzles.one_backhoe_away_from_a_very":"Ein Bagger trennt dich von einer sehr langen Nacht. Ein zweiter Weg gibt ⭐⭐⭐.",
"puzzles.one_cut_splits_it":"Ein Schnitt trennt es",
"puzzles.one_cut_splits_it_where":"Ein Schnitt trennt es: {where}",
"puzzles.one_ring_through_every_pop":"Ein Ring durch jeden POP",
"puzzles.one_very_big_island_and_a":"Eine sehr große Insel und sehr viel sehr leere Glasfaser.",
"puzzles.open_a_pop_cost":"POP eröffnen · {cost}",
"puzzles.pacific_rim_shot":"Pacific Rim Shot",
"puzzles.ping_pong_to_tokyo":"Ping-Pong nach Tokio",
"puzzles.price_per_year":"{price}/Jahr",
"puzzles.puzzle":"Puzzle",
"puzzles.puzzle_solved":"Puzzle gelöst",
"puzzles.puzzles":"Puzzles",
"puzzles.remove_this_link":"Diesen Link entfernen",
"puzzles.remove_this_pop":"Diesen POP entfernen",
"puzzles.reset":"Zurücksetzen",
"puzzles.retry_for_3_stars":"Nochmal für ⭐⭐⭐",
"puzzles.ring":"Ring",
"puzzles.ring_of_fire":"Ring of Fire",
"puzzles.rock_solid_and_gold_plated_the":"Felsenfest und vergoldet. Der CFO hat Fragen.",
"puzzles.samba_sprint":"Samba-Sprint",
"puzzles.same_puzzle_for_everyone_this_week":"Diese Woche für alle dasselbe Puzzle",
"puzzles.same_trench_cheaper_one_backhoe_cuts":"Gleicher Graben (billiger, ein Bagger kappt beide)",
"puzzles.sao_paulo_to_miami_before_the":"São Paulo nach Miami, bevor der Caipirinha warm wird.",
"puzzles.sea_to_shining_sea":"Von Küste zu Küste",
"puzzles.seattle_to_singapore_with_a_stop":"Seattle nach Singapur, mit Zwischenstopp für Sushi und Dim Sum.",
"puzzles.share_line":"Series of Tubes Puzzle {what} {stars} {spend} · seriesoftub.es",
"puzzles.size":"Größe",
"puzzles.small_calm_network_builds":"Kleine, entspannte Netzbauten",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.speed_runs":"Speedruns",
"puzzles.spent_x":"Ausgegeben {x}",
"puzzles.spent_x_of_y":"Ausgegeben {x} / {y}",
"puzzles.stepping_stone_optional":"Trittstein (optional)",
"puzzles.suez_you_later":"Suez bald",
"puzzles.survives_any_single_cut":"Übersteht jeden einzelnen Schnitt",
"puzzles.tap_a_goal_city_to_open":"Tipp auf eine leuchtende Stadt für deinen ersten POP",
"puzzles.that_city_is_not_part_of":"Diese Stadt gehört nicht zu diesem Puzzle.",
"puzzles.the_pacific_is_big_light_is":"Der Pazifik ist groß. Licht ist schnell. Dein Budget ist beides nicht.",
"puzzles.the_pacific_rim_where_every_hop":"Der Pazifikrand, wo jeder Hop ein Ozean ist.",
"puzzles.the_shark_tank":"Das Haifischbecken",
"puzzles.the_sharks_have_been_biting_again":"Die Haie haben wieder zugebissen. Bleib auf dem Trockenen.",
"puzzles.the_sharks_say_no":"Die Haie sagen nein.",
"puzzles.three_cities_two_currencies_one_very":"Drei Städte, zwei Währungen, ein sehr kurzer Tunnel unter dem Meer.",
"puzzles.traders_paid_millions_to_shave_milliseconds":"Trader haben Millionen bezahlt, um hier Millisekunden zu sparen. Du schaffst es billiger.",
"puzzles.two_cables_across_the_atlantic_because":"Zwei Kabel über den Atlantik, denn eins ist eine Hoffnung, kein Plan.",
"puzzles.under_n_ms":"unter {n} ms",
"puzzles.undo":"Rückgängig",
"puzzles.unlocks_at_n_stars":"Ab {n}⭐",
"puzzles.weekly_puzzle":"Wochenpuzzle",
"puzzles.weekly_puzzle_key":"Wochenpuzzle {key}",
"puzzles.with_the_pop_price":"mit POP: {price}",
"puzzles.your_first_tubes_no_pressure":"Deine ersten Röhren. Kein Druck, kein Budget.",
"puzzles.your_stars":"Deine Sterne",
"reach_and_subsea.premium_submarine_terminals":"Premium-Seekabel-Terminals",
"release_notes.and_n_more_change":{"one":"… und {n} weitere Änderung","other":"… und {n} weitere Änderungen"},
"release_notes.read_the_full_notes_on_github":"Alle Hinweise auf GitHub lesen",

View file

@ -2659,6 +2659,122 @@
"progress.under_attack_now":"Bajo ataque ahora",
"progress.your_score_peak_traffic":"Tu puntuación: tráfico pico",
"progress.your_traffic_to_and_from_asia":"Tu tráfico desde y hacia Asia",
"puzzles.a_backhoe_walks_into_your_network":"Una retroexcavadora entra en tu red. No pasa nada.",
"puzzles.a_pop_costs_setup_plus_a_year":"Un POP cuesta {setup} de instalación y luego {mo}/mes. Los puzles cuentan la instalación y un año de alquiler.",
"puzzles.a_tiny_island_where_half_the":"Una isla diminuta donde medio Pacífico de cables para a tomar café.",
"puzzles.a_to_b_under_ms":"{a} → {b} en menos de {ms} ms",
"puzzles.a_to_b_under_ms_now":"{a} → {b} en menos de {ms} ms (ahora {now} ms)",
"puzzles.aloha_latency":"Aloha, latencia",
"puzzles.avoid_list":"sin {list}",
"puzzles.back_to_my_network":"Volver a mi red",
"puzzles.back_to_the_title":"Volver a la pantalla de inicio",
"puzzles.beat_the_clock_light_in_glass":"La luz en la fibra hace 200 km por milisegundo. Elige tus cables como si importara.",
"puzzles.belt_and_braces":"Cinturón y tirantes",
"puzzles.best_x":"mejor {x}",
"puzzles.budget":"Presupuesto",
"puzzles.budget_x":"presupuesto {x}",
"puzzles.connect_list":"Conecta {list}.",
"puzzles.connected":"Conectado",
"puzzles.copied_paste_it_anywhere":"¡Copiado! Pégalo donde quieras:<br>{t}",
"puzzles.de_kicks_sales_has_your_number":"Ventas de DE-KICKS tiene tu número. Conecta Alemania sin pasar por Fráncfort.",
"puzzles.diverse_route_40_survives_a_backhoe":"Ruta diversa (+40 %, sobrevive a una retroexcavadora)",
"puzzles.down_under_up_and_running":"Down Under, en marcha",
"puzzles.drag_from_a_pink_pop_to":"Arrastra desde un POP rosa a otra ciudad para alquilar una onda",
"puzzles.drag_from_this_pop_onto_another":"Arrastra desde este POP a otra ciudad del puzle, o elige una aquí.",
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Todo internet empieza con un tubo.",
"puzzles.every_link_n_g_or_more":"Cada enlace de {n}G o más",
"puzzles.fat_pipes_only":"Solo tuberías gordas",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Para arquitectos que duermen tranquilos en temporada de retroexcavadoras.",
"puzzles.four_capitals_one_very_long_winter":"Cuatro capitales, un invierno larguísimo y cero excusas para caerse.",
"puzzles.four_cities_four_cables_one_ring":"Cuatro ciudades, un anillo. Tolkien lo aprobaría; tu NOC, seguro.",
"puzzles.four_cities_one_continent_and_a":"Cuatro ciudades, un continente y mucho maíz entre medias.",
"puzzles.frankfurt_to_singapore_the_short_way":"De Fráncfort a Singapur por el camino corto. El largo va por tierra, y se nota.",
"puzzles.free":"Gratis",
"puzzles.goal":"Objetivo",
"puzzles.goal_city":"Ciudad objetivo",
"puzzles.guam_slam":"Guam Slam",
"puzzles.hello_world":"Hola, mundo",
"puzzles.honolulu_the_world_s_most_scenic":"Honolulu: el sitio de regeneración más bonito del mundo.",
"puzzles.includes_a_new_pop_in_city":"Incluye un POP nuevo en {city} ({price} por un año).",
"puzzles.it_works_finance_and_the_backhoe":"¡Funciona! Finanzas y la retroexcavadora quieren hablar contigo.",
"puzzles.keep_building":"Seguir construyendo",
"puzzles.kiwi_fruit_salad":"Macedonia de kiwi",
"puzzles.lease_a_wave_to":"Alquilar una onda hasta",
"puzzles.more_puzzles":"Más puzles",
"puzzles.n_1_club":"Club N-1",
"puzzles.n_1_connect_everything_first":"N-1: primero conéctalo todo",
"puzzles.n_g_links":"enlaces de {n}G",
"puzzles.n_week_streak":{"one":"{n} semana seguida","other":"{n} semanas seguidas"},
"puzzles.new_zealand_is_far_from_everything":"Nueva Zelanda está lejos de todo. Esa es la gracia, y el problema.",
"puzzles.next_pack_unlocks_at_n":"El siguiente pack, {pack}, se desbloquea con {n}⭐",
"puzzles.next_puzzle":"Siguiente puzle",
"puzzles.no_budget":"sin presupuesto",
"puzzles.no_budget_star_on_the_house":"sin presupuesto: ⭐ invita la casa",
"puzzles.no_cable_lands_in_both_try":"Ningún cable llega a {a} y a {b}. Prueba con una escala entre medias.",
"puzzles.no_clock_no_bills_nothing_breaks":"Sin reloj, sin facturas, nada se rompe. Conecta las ciudades y ve a por tres estrellas: bajo presupuesto, y aún conectado si se corta cualquier enlace.",
"puzzles.no_pop_in_list":"Ningún POP en {list}",
"puzzles.no_subsea":"sin submarinos",
"puzzles.no_subsea_cables":"Sin cables submarinos",
"puzzles.nobody_ever_got_fired_for_buying":"A nadie lo han despedido nunca por comprar 100G.",
"puzzles.not_this_one_find_a_way_around":"Esta no. Busca otro camino.",
"puzzles.not_through_frankfurt":"Sin pasar por Fráncfort",
"puzzles.off_limits":"Prohibida",
"puzzles.on_the_house":"Invita la casa",
"puzzles.one_backhoe_away_from_a_very":"A una retroexcavadora de una noche muy larga. Añade un segundo camino para ⭐⭐⭐.",
"puzzles.one_cut_splits_it":"Un corte la parte en dos",
"puzzles.one_cut_splits_it_where":"Un corte la parte en dos: {where}",
"puzzles.one_ring_through_every_pop":"Un anillo por todos los POP",
"puzzles.one_very_big_island_and_a":"Una isla enorme y muchísima fibra vacía.",
"puzzles.open_a_pop_cost":"Abrir un POP · {cost}",
"puzzles.pacific_rim_shot":"Pacific Rim Shot",
"puzzles.ping_pong_to_tokyo":"Ping-pong a Tokio",
"puzzles.price_per_year":"{price}/año",
"puzzles.puzzle":"Puzle",
"puzzles.puzzle_solved":"Puzle resuelto",
"puzzles.puzzles":"Puzles",
"puzzles.remove_this_link":"Quitar este enlace",
"puzzles.remove_this_pop":"Quitar este POP",
"puzzles.reset":"Reiniciar",
"puzzles.retry_for_3_stars":"Reintentar para ⭐⭐⭐",
"puzzles.ring":"anillo",
"puzzles.ring_of_fire":"Anillo de fuego",
"puzzles.rock_solid_and_gold_plated_the":"A prueba de bombas, y bañado en oro. El director financiero tiene preguntas.",
"puzzles.samba_sprint":"Sprint de samba",
"puzzles.same_puzzle_for_everyone_this_week":"El mismo puzle para todos esta semana",
"puzzles.same_trench_cheaper_one_backhoe_cuts":"Misma zanja (más barata, una retroexcavadora corta las dos)",
"puzzles.sao_paulo_to_miami_before_the":"De São Paulo a Miami antes de que se caliente la caipiriña.",
"puzzles.sea_to_shining_sea":"De costa a costa",
"puzzles.seattle_to_singapore_with_a_stop":"De Seattle a Singapur, con parada para sushi y dim sum.",
"puzzles.share_line":"Series of Tubes puzle {what} {stars} {spend} · seriesoftub.es",
"puzzles.size":"Tamaño",
"puzzles.small_calm_network_builds":"Redes pequeñas y tranquilas",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.speed_runs":"Contrarreloj",
"puzzles.spent_x":"Gastado {x}",
"puzzles.spent_x_of_y":"Gastado {x} / {y}",
"puzzles.stepping_stone_optional":"Escala (opcional)",
"puzzles.suez_you_later":"Suez luego",
"puzzles.survives_any_single_cut":"Sobrevive a cualquier corte",
"puzzles.tap_a_goal_city_to_open":"Toca una ciudad brillante para abrir tu primer POP",
"puzzles.that_city_is_not_part_of":"Esa ciudad no forma parte de este puzle.",
"puzzles.the_pacific_is_big_light_is":"El Pacífico es grande. La luz es rápida. Tu presupuesto no es ninguna de las dos cosas.",
"puzzles.the_pacific_rim_where_every_hop":"El borde del Pacífico, donde cada salto es un océano.",
"puzzles.the_shark_tank":"La pecera de tiburones",
"puzzles.the_sharks_have_been_biting_again":"Los tiburones vuelven a morder. Quédate en tierra firme.",
"puzzles.the_sharks_say_no":"Los tiburones dicen que no.",
"puzzles.three_cities_two_currencies_one_very":"Tres ciudades, dos monedas y un túnel muy corto bajo el mar.",
"puzzles.traders_paid_millions_to_shave_milliseconds":"Los traders pagaron millones por arañar milisegundos a esta ruta. Tú lo harás por menos.",
"puzzles.two_cables_across_the_atlantic_because":"Dos cables cruzando el Atlántico, porque uno es una esperanza, no un plan.",
"puzzles.under_n_ms":"menos de {n} ms",
"puzzles.undo":"Deshacer",
"puzzles.unlocks_at_n_stars":"Se desbloquea con {n}⭐",
"puzzles.weekly_puzzle":"Puzle semanal",
"puzzles.weekly_puzzle_key":"Puzle semanal {key}",
"puzzles.with_the_pop_price":"con el POP: {price}",
"puzzles.your_first_tubes_no_pressure":"Tus primeros tubos. Sin presión, sin presupuesto.",
"puzzles.your_stars":"Tus estrellas",
"reach_and_subsea.premium_submarine_terminals":"Terminales submarinas premium",
"release_notes.and_n_more_change":{"one":"…y {n} cambio más","other":"…y {n} cambios más"},
"release_notes.read_the_full_notes_on_github":"Lee las notas completas en GitHub",

View file

@ -2659,6 +2659,122 @@
"progress.under_attack_now":"Sous attaque",
"progress.your_score_peak_traffic":"Ton score : pic de trafic",
"progress.your_traffic_to_and_from_asia":"Ton trafic vers et depuis l’Asie",
"puzzles.a_backhoe_walks_into_your_network":"C’est une pelleteuse qui entre dans ton réseau. Il ne se passe rien.",
"puzzles.a_pop_costs_setup_plus_a_year":"Un POP coûte {setup} à installer, puis {mo}/mois. Les puzzles comptent l’installation et un an de loyer.",
"puzzles.a_tiny_island_where_half_the":"Une île minuscule où la moitié des câbles du Pacifique s’arrêtent pour un café.",
"puzzles.a_to_b_under_ms":"{a} → {b} en moins de {ms} ms",
"puzzles.a_to_b_under_ms_now":"{a} → {b} en moins de {ms} ms (actuellement {now} ms)",
"puzzles.aloha_latency":"Aloha la latence",
"puzzles.avoid_list":"sans {list}",
"puzzles.back_to_my_network":"Retour à mon réseau",
"puzzles.back_to_the_title":"Retour à l’écran titre",
"puzzles.beat_the_clock_light_in_glass":"La lumière dans la fibre fait 200 km par milliseconde. Choisis tes câbles comme si ça comptait.",
"puzzles.belt_and_braces":"Ceinture et bretelles",
"puzzles.best_x":"record {x}",
"puzzles.budget":"Budget",
"puzzles.budget_x":"budget {x}",
"puzzles.connect_list":"Relie {list}.",
"puzzles.connected":"Relié",
"puzzles.copied_paste_it_anywhere":"Copié ! Colle-le où tu veux :<br>{t}",
"puzzles.de_kicks_sales_has_your_number":"Les commerciaux de DE-KICKS ont ton numéro. Relie l’Allemagne sans passer par Francfort.",
"puzzles.diverse_route_40_survives_a_backhoe":"Route diverse (+40 %, survit à une pelleteuse)",
"puzzles.down_under_up_and_running":"Down Under, ça tourne",
"puzzles.drag_from_a_pink_pop_to":"Glisse depuis un POP rose vers une autre ville pour louer une longueur d’onde",
"puzzles.drag_from_this_pop_onto_another":"Glisse depuis ce POP vers une autre ville du puzzle, ou choisis-en une ici.",
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Tout internet commence par un tube.",
"puzzles.every_link_n_g_or_more":"Chaque lien à {n}G ou plus",
"puzzles.fat_pipes_only":"Gros tuyaux uniquement",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Pour les architectes qui dorment pendant la saison des pelleteuses.",
"puzzles.four_capitals_one_very_long_winter":"Quatre capitales, un très long hiver, zéro excuse pour une panne.",
"puzzles.four_cities_four_cables_one_ring":"Quatre villes, un anneau. Tolkien approuverait ; ton NOC, à coup sûr.",
"puzzles.four_cities_one_continent_and_a":"Quatre villes, un continent et beaucoup de maïs entre les deux.",
"puzzles.frankfurt_to_singapore_the_short_way":"Francfort–Singapour par le chemin court. Le long passe par la terre, et ça se voit.",
"puzzles.free":"Gratuit",
"puzzles.goal":"Objectif",
"puzzles.goal_city":"Ville objectif",
"puzzles.guam_slam":"Guam Slam",
"puzzles.hello_world":"Hello, World",
"puzzles.honolulu_the_world_s_most_scenic":"Honolulu : le site de régénération le plus pittoresque du monde.",
"puzzles.includes_a_new_pop_in_city":"Inclut un nouveau POP à {city} ({price} pour un an).",
"puzzles.it_works_finance_and_the_backhoe":"Ça marche ! La compta et la pelleteuse aimeraient te dire un mot.",
"puzzles.keep_building":"Continuer à construire",
"puzzles.kiwi_fruit_salad":"Salade de kiwis",
"puzzles.lease_a_wave_to":"Louer une longueur d’onde vers",
"puzzles.more_puzzles":"Plus de puzzles",
"puzzles.n_1_club":"Club N-1",
"puzzles.n_1_connect_everything_first":"N-1 : relie d’abord tout",
"puzzles.n_g_links":"liens {n}G",
"puzzles.n_week_streak":{"one":"{n} semaine d’affilée","other":"{n} semaines d’affilée"},
"puzzles.new_zealand_is_far_from_everything":"La Nouvelle-Zélande est loin de tout. C’est tout l’intérêt, et tout le problème.",
"puzzles.next_pack_unlocks_at_n":"Prochain pack, {pack}, à {n}⭐",
"puzzles.next_puzzle":"Puzzle suivant",
"puzzles.no_budget":"sans budget",
"puzzles.no_budget_star_on_the_house":"sans budget : ⭐ offerte par la maison",
"puzzles.no_cable_lands_in_both_try":"Aucun câble n’atterrit à la fois à {a} et à {b}. Essaie une escale entre les deux.",
"puzzles.no_clock_no_bills_nothing_breaks":"Pas d’horloge, pas de factures, rien ne casse. Relie les villes, puis vise trois étoiles : sous le budget, et toujours relié si n’importe quel lien est coupé.",
"puzzles.no_pop_in_list":"Aucun POP à {list}",
"puzzles.no_subsea":"pas de sous-marin",
"puzzles.no_subsea_cables":"Pas de câbles sous-marins",
"puzzles.nobody_ever_got_fired_for_buying":"Personne ne s’est jamais fait virer pour avoir acheté du 100G.",
"puzzles.not_this_one_find_a_way_around":"Pas celle-là. Trouve un détour.",
"puzzles.not_through_frankfurt":"Pas par Francfort",
"puzzles.off_limits":"Interdite",
"puzzles.on_the_house":"Offert par la maison",
"puzzles.one_backhoe_away_from_a_very":"À une pelleteuse d’une très longue nuit. Ajoute un deuxième chemin pour ⭐⭐⭐.",
"puzzles.one_cut_splits_it":"Une coupure le divise",
"puzzles.one_cut_splits_it_where":"Une coupure le divise : {where}",
"puzzles.one_ring_through_every_pop":"Un anneau qui passe par chaque POP",
"puzzles.one_very_big_island_and_a":"Une très grande île, et beaucoup de fibre très vide.",
"puzzles.open_a_pop_cost":"Ouvrir un POP · {cost}",
"puzzles.pacific_rim_shot":"Pacific Rim Shot",
"puzzles.ping_pong_to_tokyo":"Ping-pong jusqu’à Tokyo",
"puzzles.price_per_year":"{price}/an",
"puzzles.puzzle":"Puzzle",
"puzzles.puzzle_solved":"Puzzle résolu",
"puzzles.puzzles":"Puzzles",
"puzzles.remove_this_link":"Supprimer ce lien",
"puzzles.remove_this_pop":"Supprimer ce POP",
"puzzles.reset":"Recommencer",
"puzzles.retry_for_3_stars":"Réessayer pour ⭐⭐⭐",
"puzzles.ring":"anneau",
"puzzles.ring_of_fire":"Ceinture de feu",
"puzzles.rock_solid_and_gold_plated_the":"Solide comme un roc, et plaqué or. Le DAF a des questions.",
"puzzles.samba_sprint":"Sprint samba",
"puzzles.same_puzzle_for_everyone_this_week":"Le même puzzle pour tout le monde cette semaine",
"puzzles.same_trench_cheaper_one_backhoe_cuts":"Même tranchée (moins cher, une pelleteuse coupe les deux)",
"puzzles.sao_paulo_to_miami_before_the":"São Paulo–Miami avant que la caïpirinha ne tiédisse.",
"puzzles.sea_to_shining_sea":"D’une côte à l’autre",
"puzzles.seattle_to_singapore_with_a_stop":"Seattle–Singapour, avec une escale sushis et dim sum.",
"puzzles.share_line":"Series of Tubes puzzle {what} {stars} {spend} · seriesoftub.es",
"puzzles.size":"Taille",
"puzzles.small_calm_network_builds":"Petits réseaux, tranquillement",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.speed_runs":"Contre la montre",
"puzzles.spent_x":"Dépensé {x}",
"puzzles.spent_x_of_y":"Dépensé {x} / {y}",
"puzzles.stepping_stone_optional":"Escale (facultative)",
"puzzles.suez_you_later":"Suez la prochaine",
"puzzles.survives_any_single_cut":"Survit à n’importe quelle coupure",
"puzzles.tap_a_goal_city_to_open":"Touche une ville lumineuse pour ouvrir ton premier POP",
"puzzles.that_city_is_not_part_of":"Cette ville ne fait pas partie de ce puzzle.",
"puzzles.the_pacific_is_big_light_is":"Le Pacifique est grand. La lumière est rapide. Ton budget n’est ni l’un ni l’autre.",
"puzzles.the_pacific_rim_where_every_hop":"Le pourtour du Pacifique, où chaque saut est un océan.",
"puzzles.the_shark_tank":"L’aquarium à requins",
"puzzles.the_sharks_have_been_biting_again":"Les requins ont encore mordu. Reste sur la terre ferme.",
"puzzles.the_sharks_say_no":"Les requins disent non.",
"puzzles.three_cities_two_currencies_one_very":"Trois villes, deux monnaies, un tout petit tunnel sous la mer.",
"puzzles.traders_paid_millions_to_shave_milliseconds":"Des traders ont payé des millions pour gratter des millisecondes sur cette route. Toi, tu le fais pour moins cher.",
"puzzles.two_cables_across_the_atlantic_because":"Deux câbles à travers l’Atlantique, parce qu’un seul, c’est un espoir, pas un plan.",
"puzzles.under_n_ms":"moins de {n} ms",
"puzzles.undo":"Annuler",
"puzzles.unlocks_at_n_stars":"À partir de {n}⭐",
"puzzles.weekly_puzzle":"Puzzle de la semaine",
"puzzles.weekly_puzzle_key":"Puzzle de la semaine {key}",
"puzzles.with_the_pop_price":"avec le POP : {price}",
"puzzles.your_first_tubes_no_pressure":"Tes premiers tubes. Pas de pression, pas de budget.",
"puzzles.your_stars":"Tes étoiles",
"reach_and_subsea.premium_submarine_terminals":"Terminaux sous-marins premium",
"release_notes.and_n_more_change":{"one":"…et {n} autre changement","other":"…et {n} autres changements"},
"release_notes.read_the_full_notes_on_github":"Lire les notes complètes sur GitHub",

View file

@ -2659,6 +2659,122 @@
"progress.under_attack_now":"Sotto attacco ora",
"progress.your_score_peak_traffic":"Il tuo punteggio: picco di traffico",
"progress.your_traffic_to_and_from_asia":"Il tuo traffico da e per l’Asia",
"puzzles.a_backhoe_walks_into_your_network":"Una ruspa entra nella tua rete. Non succede niente.",
"puzzles.a_pop_costs_setup_plus_a_year":"Un POP costa {setup} di attivazione, poi {mo}/mese. I puzzle contano l’attivazione e un anno di canone.",
"puzzles.a_tiny_island_where_half_the":"Un’isoletta dove metà dei cavi del Pacifico si ferma per un caffè.",
"puzzles.a_to_b_under_ms":"{a} → {b} sotto i {ms} ms",
"puzzles.a_to_b_under_ms_now":"{a} → {b} sotto i {ms} ms (ora {now} ms)",
"puzzles.aloha_latency":"Aloha latenza",
"puzzles.avoid_list":"senza {list}",
"puzzles.back_to_my_network":"Torna alla mia rete",
"puzzles.back_to_the_title":"Torna alla schermata iniziale",
"puzzles.beat_the_clock_light_in_glass":"La luce nella fibra fa 200 km al millisecondo. Scegli i cavi come se contasse.",
"puzzles.belt_and_braces":"Cintura e bretelle",
"puzzles.best_x":"record {x}",
"puzzles.budget":"Budget",
"puzzles.budget_x":"budget {x}",
"puzzles.connect_list":"Collega {list}.",
"puzzles.connected":"Collegato",
"puzzles.copied_paste_it_anywhere":"Copiato! Incollalo dove vuoi:<br>{t}",
"puzzles.de_kicks_sales_has_your_number":"Il commerciale di DE-KICKS ha il tuo numero. Collega la Germania senza passare da Francoforte.",
"puzzles.diverse_route_40_survives_a_backhoe":"Percorso diverso (+40%, sopravvive a una ruspa)",
"puzzles.down_under_up_and_running":"Down Under, operativi",
"puzzles.drag_from_a_pink_pop_to":"Trascina da un POP rosa a un’altra città per noleggiare una wave",
"puzzles.drag_from_this_pop_onto_another":"Trascina da questo POP su un’altra città del puzzle, o scegline una qui.",
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Ogni internet comincia con un tubo.",
"puzzles.every_link_n_g_or_more":"Ogni link da {n}G o più",
"puzzles.fat_pipes_only":"Solo tubi grossi",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Per architetti che dormono sonni tranquilli nella stagione delle ruspe.",
"puzzles.four_capitals_one_very_long_winter":"Quattro capitali, un inverno lunghissimo, zero scuse per i disservizi.",
"puzzles.four_cities_four_cables_one_ring":"Quattro città, un anello. Tolkien approverebbe; il tuo NOC di sicuro.",
"puzzles.four_cities_one_continent_and_a":"Quattro città, un continente e tantissimo mais in mezzo.",
"puzzles.frankfurt_to_singapore_the_short_way":"Da Francoforte a Singapore per la via corta. Quella lunga è via terra, e si vede.",
"puzzles.free":"Gratis",
"puzzles.goal":"Obiettivo",
"puzzles.goal_city":"Città obiettivo",
"puzzles.guam_slam":"Guam Slam",
"puzzles.hello_world":"Ciao, mondo",
"puzzles.honolulu_the_world_s_most_scenic":"Honolulu: il sito di rigenerazione più panoramico del mondo.",
"puzzles.includes_a_new_pop_in_city":"Include un nuovo POP a {city} ({price} per un anno).",
"puzzles.it_works_finance_and_the_backhoe":"Funziona! L’amministrazione e la ruspa vorrebbero parlarti.",
"puzzles.keep_building":"Continua a costruire",
"puzzles.kiwi_fruit_salad":"Macedonia di kiwi",
"puzzles.lease_a_wave_to":"Noleggia una wave verso",
"puzzles.more_puzzles":"Altri puzzle",
"puzzles.n_1_club":"Club N-1",
"puzzles.n_1_connect_everything_first":"N-1: prima collega tutto",
"puzzles.n_g_links":"link da {n}G",
"puzzles.n_week_streak":{"one":"{n} settimana di fila","other":"{n} settimane di fila"},
"puzzles.new_zealand_is_far_from_everything":"La Nuova Zelanda è lontana da tutto. È proprio questo il bello, e il problema.",
"puzzles.next_pack_unlocks_at_n":"Il prossimo pacchetto, {pack}, si sblocca a {n}⭐",
"puzzles.next_puzzle":"Prossimo puzzle",
"puzzles.no_budget":"senza budget",
"puzzles.no_budget_star_on_the_house":"senza budget: ⭐ offerta dalla casa",
"puzzles.no_cable_lands_in_both_try":"Nessun cavo approda sia a {a} che a {b}. Prova con una tappa in mezzo.",
"puzzles.no_clock_no_bills_nothing_breaks":"Niente orologio, niente bollette, non si rompe niente. Collega le città, poi punta alle tre stelle: sotto budget, e ancora collegato se si taglia un link qualsiasi.",
"puzzles.no_pop_in_list":"Nessun POP a {list}",
"puzzles.no_subsea":"niente sottomarini",
"puzzles.no_subsea_cables":"Niente cavi sottomarini",
"puzzles.nobody_ever_got_fired_for_buying":"Nessuno è mai stato licenziato per aver comprato 100G.",
"puzzles.not_this_one_find_a_way_around":"Questa no. Trova un altro giro.",
"puzzles.not_through_frankfurt":"Non da Francoforte",
"puzzles.off_limits":"Vietata",
"puzzles.on_the_house":"Offre la casa",
"puzzles.one_backhoe_away_from_a_very":"A una ruspa da una nottata lunghissima. Aggiungi un secondo percorso per ⭐⭐⭐.",
"puzzles.one_cut_splits_it":"Un taglio la divide",
"puzzles.one_cut_splits_it_where":"Un taglio la divide: {where}",
"puzzles.one_ring_through_every_pop":"Un anello che passa per ogni POP",
"puzzles.one_very_big_island_and_a":"Un’isola enorme e tantissima fibra vuota.",
"puzzles.open_a_pop_cost":"Apri un POP · {cost}",
"puzzles.pacific_rim_shot":"Pacific Rim Shot",
"puzzles.ping_pong_to_tokyo":"Ping pong fino a Tokyo",
"puzzles.price_per_year":"{price}/anno",
"puzzles.puzzle":"Puzzle",
"puzzles.puzzle_solved":"Puzzle risolto",
"puzzles.puzzles":"Puzzle",
"puzzles.remove_this_link":"Rimuovi questo link",
"puzzles.remove_this_pop":"Rimuovi questo POP",
"puzzles.reset":"Ricomincia",
"puzzles.retry_for_3_stars":"Riprova per ⭐⭐⭐",
"puzzles.ring":"anello",
"puzzles.ring_of_fire":"Cintura di fuoco",
"puzzles.rock_solid_and_gold_plated_the":"Solida come una roccia, e placcata d’oro. Il CFO ha delle domande.",
"puzzles.samba_sprint":"Sprint di samba",
"puzzles.same_puzzle_for_everyone_this_week":"Lo stesso puzzle per tutti questa settimana",
"puzzles.same_trench_cheaper_one_backhoe_cuts":"Stesso scavo (più economico, una ruspa li taglia tutti e due)",
"puzzles.sao_paulo_to_miami_before_the":"Da São Paulo a Miami prima che la caipirinha si scaldi.",
"puzzles.sea_to_shining_sea":"Da costa a costa",
"puzzles.seattle_to_singapore_with_a_stop":"Da Seattle a Singapore, con una sosta per sushi e dim sum.",
"puzzles.share_line":"Series of Tubes puzzle {what} {stars} {spend} · seriesoftub.es",
"puzzles.size":"Taglia",
"puzzles.small_calm_network_builds":"Piccole reti, con calma",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.speed_runs":"Corse contro il tempo",
"puzzles.spent_x":"Speso {x}",
"puzzles.spent_x_of_y":"Speso {x} / {y}",
"puzzles.stepping_stone_optional":"Tappa (facoltativa)",
"puzzles.suez_you_later":"Suez la prossima",
"puzzles.survives_any_single_cut":"Sopravvive a qualsiasi taglio",
"puzzles.tap_a_goal_city_to_open":"Tocca una città illuminata per aprire il tuo primo POP",
"puzzles.that_city_is_not_part_of":"Quella città non fa parte di questo puzzle.",
"puzzles.the_pacific_is_big_light_is":"Il Pacifico è grande. La luce è veloce. Il tuo budget non è né l’uno né l’altro.",
"puzzles.the_pacific_rim_where_every_hop":"Il bordo del Pacifico, dove ogni hop è un oceano.",
"puzzles.the_shark_tank":"La vasca degli squali",
"puzzles.the_sharks_have_been_biting_again":"Gli squali hanno ricominciato a mordere. Resta sulla terraferma.",
"puzzles.the_sharks_say_no":"Gli squali dicono di no.",
"puzzles.three_cities_two_currencies_one_very":"Tre città, due valute, un tunnel cortissimo sotto il mare.",
"puzzles.traders_paid_millions_to_shave_milliseconds":"I trader hanno pagato milioni per limare millisecondi su questa rotta. Tu ci riesci spendendo meno.",
"puzzles.two_cables_across_the_atlantic_because":"Due cavi attraverso l’Atlantico, perché uno solo è una speranza, non un piano.",
"puzzles.under_n_ms":"sotto i {n} ms",
"puzzles.undo":"Annulla",
"puzzles.unlocks_at_n_stars":"Si sblocca a {n}⭐",
"puzzles.weekly_puzzle":"Puzzle della settimana",
"puzzles.weekly_puzzle_key":"Puzzle della settimana {key}",
"puzzles.with_the_pop_price":"con il POP: {price}",
"puzzles.your_first_tubes_no_pressure":"I tuoi primi tubi. Niente pressione, niente budget.",
"puzzles.your_stars":"Le tue stelle",
"reach_and_subsea.premium_submarine_terminals":"Terminali sottomarini avanzati",
"release_notes.and_n_more_change":{"one":"…e {n} altra modifica","other":"…e altre {n} modifiche"},
"release_notes.read_the_full_notes_on_github":"Leggi le note complete su GitHub",

View file

@ -2659,6 +2659,122 @@
"progress.under_attack_now":"Sob ataque agora",
"progress.your_score_peak_traffic":"Sua pontuação: pico de tráfego",
"progress.your_traffic_to_and_from_asia":"Seu tráfego de e para a Ásia",
"puzzles.a_backhoe_walks_into_your_network":"Uma retroescavadeira entra na sua rede. Nada acontece.",
"puzzles.a_pop_costs_setup_plus_a_year":"Um POP custa {setup} de instalação e depois {mo}/mês. Os puzzles contam a instalação e um ano de aluguel.",
"puzzles.a_tiny_island_where_half_the":"Uma ilhota onde metade dos cabos do Pacífico para pra tomar um café.",
"puzzles.a_to_b_under_ms":"{a} → {b} abaixo de {ms} ms",
"puzzles.a_to_b_under_ms_now":"{a} → {b} abaixo de {ms} ms (agora {now} ms)",
"puzzles.aloha_latency":"Aloha, latência",
"puzzles.avoid_list":"sem {list}",
"puzzles.back_to_my_network":"Voltar à minha rede",
"puzzles.back_to_the_title":"Voltar à tela inicial",
"puzzles.beat_the_clock_light_in_glass":"A luz na fibra faz 200 km por milissegundo. Escolha seus cabos como se isso importasse.",
"puzzles.belt_and_braces":"Cinto e suspensórios",
"puzzles.best_x":"recorde {x}",
"puzzles.budget":"Orçamento",
"puzzles.budget_x":"orçamento {x}",
"puzzles.connect_list":"Conecte {list}.",
"puzzles.connected":"Conectado",
"puzzles.copied_paste_it_anywhere":"Copiado! Cole onde quiser:<br>{t}",
"puzzles.de_kicks_sales_has_your_number":"O comercial da DE-KICKS tem seu número. Conecte a Alemanha sem passar por Frankfurt.",
"puzzles.diverse_route_40_survives_a_backhoe":"Rota diversa (+40%, sobrevive a uma retroescavadeira)",
"puzzles.down_under_up_and_running":"Down Under, no ar",
"puzzles.drag_from_a_pink_pop_to":"Arraste de um POP rosa até outra cidade para alugar uma wave",
"puzzles.drag_from_this_pop_onto_another":"Arraste deste POP até outra cidade do puzzle, ou escolha uma aqui.",
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Toda internet começa com um tubo.",
"puzzles.every_link_n_g_or_more":"Todo link com {n}G ou mais",
"puzzles.fat_pipes_only":"Só tubos grossos",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"Para arquitetos que dormem tranquilos na temporada das retroescavadeiras.",
"puzzles.four_capitals_one_very_long_winter":"Quatro capitais, um inverno longuíssimo, zero desculpas para cair.",
"puzzles.four_cities_four_cables_one_ring":"Quatro cidades, um anel. Tolkien aprovaria; seu NOC, com certeza.",
"puzzles.four_cities_one_continent_and_a":"Quatro cidades, um continente e muito milho no meio.",
"puzzles.frankfurt_to_singapore_the_short_way":"De Frankfurt a Singapura pelo caminho curto. O longo vai por terra, e dá pra notar.",
"puzzles.free":"Grátis",
"puzzles.goal":"Objetivo",
"puzzles.goal_city":"Cidade objetivo",
"puzzles.guam_slam":"Guam Slam",
"puzzles.hello_world":"Olá, mundo",
"puzzles.honolulu_the_world_s_most_scenic":"Honolulu: o ponto de regeneração mais bonito do mundo.",
"puzzles.includes_a_new_pop_in_city":"Inclui um POP novo em {city} ({price} por um ano).",
"puzzles.it_works_finance_and_the_backhoe":"Funciona! O financeiro e a retroescavadeira querem uma palavrinha.",
"puzzles.keep_building":"Continuar construindo",
"puzzles.kiwi_fruit_salad":"Salada de kiwi",
"puzzles.lease_a_wave_to":"Alugar uma wave até",
"puzzles.more_puzzles":"Mais puzzles",
"puzzles.n_1_club":"Clube N-1",
"puzzles.n_1_connect_everything_first":"N-1: conecte tudo primeiro",
"puzzles.n_g_links":"links de {n}G",
"puzzles.n_week_streak":{"one":"{n} semana seguida","other":"{n} semanas seguidas"},
"puzzles.new_zealand_is_far_from_everything":"A Nova Zelândia fica longe de tudo. Essa é a graça, e o problema.",
"puzzles.next_pack_unlocks_at_n":"O próximo pacote, {pack}, abre com {n}⭐",
"puzzles.next_puzzle":"Próximo puzzle",
"puzzles.no_budget":"sem orçamento",
"puzzles.no_budget_star_on_the_house":"sem orçamento: ⭐ por conta da casa",
"puzzles.no_cable_lands_in_both_try":"Nenhum cabo chega a {a} e a {b}. Tente uma escala no meio.",
"puzzles.no_clock_no_bills_nothing_breaks":"Sem relógio, sem contas, nada quebra. Conecte as cidades e busque três estrelas: dentro do orçamento, e ainda conectado se qualquer link for cortado.",
"puzzles.no_pop_in_list":"Nenhum POP em {list}",
"puzzles.no_subsea":"sem submarino",
"puzzles.no_subsea_cables":"Sem cabos submarinos",
"puzzles.nobody_ever_got_fired_for_buying":"Ninguém nunca foi demitido por comprar 100G.",
"puzzles.not_this_one_find_a_way_around":"Essa não. Dê a volta.",
"puzzles.not_through_frankfurt":"Sem passar por Frankfurt",
"puzzles.off_limits":"Proibida",
"puzzles.on_the_house":"Por conta da casa",
"puzzles.one_backhoe_away_from_a_very":"A uma retroescavadeira de uma noite muito longa. Adicione um segundo caminho para ⭐⭐⭐.",
"puzzles.one_cut_splits_it":"Um corte divide a rede",
"puzzles.one_cut_splits_it_where":"Um corte divide a rede: {where}",
"puzzles.one_ring_through_every_pop":"Um anel passando por todos os POPs",
"puzzles.one_very_big_island_and_a":"Uma ilha enorme e muita fibra vazia.",
"puzzles.open_a_pop_cost":"Abrir um POP · {cost}",
"puzzles.pacific_rim_shot":"Pacific Rim Shot",
"puzzles.ping_pong_to_tokyo":"Pingue-pongue até Tóquio",
"puzzles.price_per_year":"{price}/ano",
"puzzles.puzzle":"Puzzle",
"puzzles.puzzle_solved":"Puzzle resolvido",
"puzzles.puzzles":"Puzzles",
"puzzles.remove_this_link":"Remover este link",
"puzzles.remove_this_pop":"Remover este POP",
"puzzles.reset":"Recomeçar",
"puzzles.retry_for_3_stars":"Tentar de novo por ⭐⭐⭐",
"puzzles.ring":"anel",
"puzzles.ring_of_fire":"Anel de Fogo",
"puzzles.rock_solid_and_gold_plated_the":"Sólida como rocha, e banhada a ouro. O CFO tem perguntas.",
"puzzles.samba_sprint":"Corrida de samba",
"puzzles.same_puzzle_for_everyone_this_week":"O mesmo puzzle para todo mundo nesta semana",
"puzzles.same_trench_cheaper_one_backhoe_cuts":"Mesma vala (mais barata, uma retroescavadeira corta as duas)",
"puzzles.sao_paulo_to_miami_before_the":"De São Paulo a Miami antes que a caipirinha esquente.",
"puzzles.sea_to_shining_sea":"De costa a costa",
"puzzles.seattle_to_singapore_with_a_stop":"De Seattle a Singapura, com parada para sushi e dim sum.",
"puzzles.share_line":"Series of Tubes puzzle {what} {stars} {spend} · seriesoftub.es",
"puzzles.size":"Tamanho",
"puzzles.small_calm_network_builds":"Redes pequenas, com calma",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.speed_runs":"Contra o relógio",
"puzzles.spent_x":"Gasto {x}",
"puzzles.spent_x_of_y":"Gasto {x} / {y}",
"puzzles.stepping_stone_optional":"Escala (opcional)",
"puzzles.suez_you_later":"Suez mais tarde",
"puzzles.survives_any_single_cut":"Sobrevive a qualquer corte",
"puzzles.tap_a_goal_city_to_open":"Toque numa cidade brilhante para abrir seu primeiro POP",
"puzzles.that_city_is_not_part_of":"Essa cidade não faz parte deste puzzle.",
"puzzles.the_pacific_is_big_light_is":"O Pacífico é grande. A luz é rápida. Seu orçamento não é nenhum dos dois.",
"puzzles.the_pacific_rim_where_every_hop":"A borda do Pacífico, onde cada salto é um oceano.",
"puzzles.the_shark_tank":"O aquário dos tubarões",
"puzzles.the_sharks_have_been_biting_again":"Os tubarões voltaram a morder. Fique em terra firme.",
"puzzles.the_sharks_say_no":"Os tubarões dizem não.",
"puzzles.three_cities_two_currencies_one_very":"Três cidades, duas moedas e um túnel bem curtinho debaixo do mar.",
"puzzles.traders_paid_millions_to_shave_milliseconds":"Traders pagaram milhões para tirar milissegundos desta rota. Você faz por menos.",
"puzzles.two_cables_across_the_atlantic_because":"Dois cabos atravessando o Atlântico, porque um só é esperança, não plano.",
"puzzles.under_n_ms":"abaixo de {n} ms",
"puzzles.undo":"Desfazer",
"puzzles.unlocks_at_n_stars":"Abre com {n}⭐",
"puzzles.weekly_puzzle":"Puzzle da semana",
"puzzles.weekly_puzzle_key":"Puzzle da semana {key}",
"puzzles.with_the_pop_price":"com o POP: {price}",
"puzzles.your_first_tubes_no_pressure":"Seus primeiros tubos. Sem pressão, sem orçamento.",
"puzzles.your_stars":"Suas estrelas",
"reach_and_subsea.premium_submarine_terminals":"Terminais submarinos premium",
"release_notes.and_n_more_change":{"one":"…e mais {n} mudança","other":"…e mais {n} mudanças"},
"release_notes.read_the_full_notes_on_github":"Leia as notas completas no GitHub",

View file

@ -0,0 +1,39 @@
/* Puzzles: one entry per line, in play order. A puzzle is data:
id, pack, n (name), j (one-line joke), cities (all must end up connected), via (optional stepping stones),
budget (setup + a year of monthly, 0 = no budget star to chase: it is given), and at most a twist or two:
noSub (no subsea cables), ring (one ring through every POP), lat:[a,b,ms] (best path under ms), minG (every link at
least this many Gbps), avoid (cities shown on the map that you may not build in). */
const PZ_PACKS=[
{id:'hello',n:tr('puzzles.hello_world'),d:tr('puzzles.your_first_tubes_no_pressure'),need:0},
{id:'fire',n:tr('puzzles.ring_of_fire'),d:tr('puzzles.the_pacific_rim_where_every_hop'),need:6},
{id:'speed',n:tr('puzzles.speed_runs'),d:tr('puzzles.beat_the_clock_light_in_glass'),need:14},
{id:'n1',n:tr('puzzles.n_1_club'),d:tr('puzzles.for_architects_who_sleep_through_backhoes'),need:22},
];
const PZ=[
{id:'hello',pack:'hello',n:tr('puzzles.hello_world'),j:tr('puzzles.every_internet_starts_with_one_tube'),cities:['lon','nyc'],budget:0},
{id:'eurotrip',pack:'hello',n:tr('puzzles.euro_trip'),j:tr('puzzles.three_cities_two_currencies_one_very'),cities:['lon','ams','fra'],budget:0},
{id:'shining',pack:'hello',n:tr('puzzles.sea_to_shining_sea'),j:tr('puzzles.four_cities_one_continent_and_a'),cities:['nyc','chi','dal','sjc'],budget:300000},
{id:'smorgas',pack:'hello',n:tr('puzzles.smorgasbord'),j:tr('puzzles.four_capitals_one_very_long_winter'),cities:['osl','sto','cph','hel'],budget:190000},
{id:'downunder',pack:'hello',n:tr('puzzles.down_under_up_and_running'),j:tr('puzzles.one_very_big_island_and_a'),cities:['syd','mel','bne','adl'],budget:300000},
{id:'aloha',pack:'fire',n:tr('puzzles.aloha_latency'),j:tr('puzzles.honolulu_the_world_s_most_scenic'),cities:['sjc','hnl','syd'],budget:1750000},
{id:'rimshot',pack:'fire',n:tr('puzzles.pacific_rim_shot'),j:tr('puzzles.seattle_to_singapore_with_a_stop'),cities:['sea','tok','hkg','sin'],budget:1200000},
{id:'fire',pack:'fire',n:tr('puzzles.ring_of_fire'),j:tr('puzzles.four_cities_four_cables_one_ring'),cities:['tok','hkg','sin','syd'],ring:true,budget:1600000},
{id:'kiwi',pack:'fire',n:tr('puzzles.kiwi_fruit_salad'),j:tr('puzzles.new_zealand_is_far_from_everything'),cities:['akl','syd','sea'],via:['hnl','suv'],budget:1400000},
{id:'guam',pack:'fire',n:tr('puzzles.guam_slam'),j:tr('puzzles.a_tiny_island_where_half_the'),cities:['tok','mnl','syd'],via:['gum'],budget:1600000},
{id:'flash',pack:'speed',n:tr('puzzles.flash_boys'),j:tr('puzzles.traders_paid_millions_to_shave_milliseconds'),cities:['nyc','lon'],lat:['nyc','lon',27],budget:450000},
{id:'pingpong',pack:'speed',n:tr('puzzles.ping_pong_to_tokyo'),j:tr('puzzles.the_pacific_is_big_light_is'),cities:['lax','tok'],via:['sea','sjc'],lat:['lax','tok',47],budget:850000},
{id:'suez',pack:'speed',n:tr('puzzles.suez_you_later'),j:tr('puzzles.frankfurt_to_singapore_the_short_way'),cities:['fra','sin'],via:['mrs','bom'],lat:['fra','sin',68],budget:1000000},
{id:'samba',pack:'speed',n:tr('puzzles.samba_sprint'),j:tr('puzzles.sao_paulo_to_miami_before_the'),cities:['sao','mia'],via:['for','rio'],lat:['sao','mia',45],budget:950000},
{id:'sharks',pack:'n1',n:tr('puzzles.the_shark_tank'),j:tr('puzzles.the_sharks_have_been_biting_again'),cities:['lis','mad','par','mil'],via:['bcn','mrs'],noSub:true,budget:210000},
{id:'braces',pack:'n1',n:tr('puzzles.belt_and_braces'),j:tr('puzzles.two_cables_across_the_atlantic_because'),cities:['nyc','lon','dub'],budget:380000},
{id:'nofra',pack:'n1',n:tr('puzzles.not_through_frankfurt'),j:tr('puzzles.de_kicks_sales_has_your_number'),cities:['ams','ber','muc','zrh'],via:['ham','dus'],avoid:['fra'],budget:200000},
{id:'fatpipes',pack:'n1',n:tr('puzzles.fat_pipes_only'),j:tr('puzzles.nobody_ever_got_fired_for_buying'),cities:['par','mrs','mil','zrh'],minG:100,budget:240000},
];
// Weekly puzzle pools: each is one landmass and one region, so every pair has an overland route.
const PZ_WEEK_POOLS=[
['fra','ams','par','mad','mil','ber','waw','vie','sto','cph','prg','zrh','bcn','mrs','muc','bud'],
['nyc','chi','dal','sea','sjc','lax','mia','ash','atn','den','bos','hou','phx','tor','mtl'],
['sao','rio','bsb','bhz','cwb','poa','ssa','rec','for','cpq'],
['syd','mel','bne','adl','cbr','per'],
['bom','del','maa','blr','hyd'],
];

View file

@ -0,0 +1,104 @@
/* ================= PUZZLES (#190) =================
Small, calm builds: connect a few cities, earn up to three stars. A puzzle runs as its own S (S.mode='puzzle'):
no clock, no bills, no incidents, links up at once. That S is never saved. Only progress (stars and best spend per
puzzle, weekly results and the weekly streak) is kept, under its own key, so the main save is never touched. */
const PZ_KEY='sot-puzzles',PZ_YEAR=12;
const pzOn=()=>!!(S&&S.mode==='puzzle'&&S.pz);
const pzDef=id=>PZ.find(p=>p.id===id)||null;
const pzKind=c=>!pzOn()?null:S.pz.cities.includes(c)?'goal':S.pz.via.includes(c)?'via':S.pz.avoid.includes(c)?'avoid':null;
const pzName=d=>d.id==='weekly'?tr('puzzles.weekly_puzzle_key',{key:d.key}):d.n;
const pzStarStr=n=>'⭐'.repeat(n)+'⬜'.repeat(3-n);
// ---------- progress (localStorage, never trusted) ----------
function pzClean(j){const o={s:{},wk:{},streak:{last:null,n:0,best:0}};if(!j||typeof j!=='object')return o;
const rec=r=>r&&typeof r==='object'?{st:int(r.st,0,3,0),sp:r.sp==null||!isFinite(+r.sp)||+r.sp<0?null:Math.round(+r.sp)}:null;
if(j.s&&typeof j.s==='object')for(const k of Object.keys(j.s)){const r=rec(j.s[k]);if(pzDef(k)&&r)o.s[k]=r;}
if(j.wk&&typeof j.wk==='object')for(const k of Object.keys(j.wk)){const r=rec(j.wk[k]);if(/^\d{4}-W\d{2}$/.test(k)&&r)o.wk[k]=r;}
const st=j.streak;if(st&&typeof st==='object'){o.streak.last=typeof st.last==='string'&&/^\d{4}-W\d{2}$/.test(st.last)?st.last:null;o.streak.n=int(st.n,0,9999,0);o.streak.best=int(st.best,0,9999,0);}
return o;}
function pzLoad(){try{return pzClean(JSON.parse(localStorage.getItem(PZ_KEY)||'{}'));}catch(e){return pzClean(null);}}
function pzStore(p){try{localStorage.setItem(PZ_KEY,JSON.stringify(p));}catch(e){}}
const pzStarsTotal=p=>PZ.reduce((a,x)=>a+((p.s[x.id]||{}).st|0),0);
const pzPackOpen=(k,p)=>{const P=PZ_PACKS.find(x=>x.id===k);return !!P&&pzStarsTotal(p||pzLoad())>=P.need;};
// ---------- prices: the real game's waves, on day 0, for a year ----------
const pzMood=(a,b,sub)=>{const k=waveMarket(a,b,sub);return k.m/k.ero;};
// Overland (when the two cities share a landmass) and every cable between them, each with its price factor and latency.
function pzRoutes(a,b){const out=[],sub=isSub(a,b);
if(!sub){const km=kmBetween(a,b);out.push({via:'land',cab:null,km,sub:false,f:landMult(a,b)*pzMood(a,b,false),ms:km*1.3/200});}
for(const c of cablesFor(a,b))if(!out.some(r=>r.via===c.cid))out.push({via:c.cid,cab:c.cid,km:c.km,sub:true,f:CAB[c.cid].price*pzMood(a,b,true),ms:c.km*(CAB[c.cid].lat||1)/200});
return out;}
const pzMo=(r,tier,div)=>Math.round(waveMo(r.km,r.sub,tier)*r.f*(div?DIVERSE:1));
const pzLinkCost=(r,tier,div)=>pzMo(r,tier,div)*PZ_YEAR;// leased waves have no setup fee: a year of rent
const pzPopCost=c=>popCost(c)+PZ_YEAR*POP_MO;
const PZ_TIERS=[0,1,2];
function pzSpend(){let s=0;for(const c in S.pops)s+=pzPopCost(c);for(const l of S.links)s+=l.mo*PZ_YEAR;return s;}
// What one backhoe or one anchor takes out: waves in the same trench, or on the same cable between the same cities.
const pzUnit=l=>l.cable?'cab:'+l.cable+':'+edgeKey(l):String(l.trench||l.id);
// ---------- checks ----------
function pzComp(ls,skip,from){const adj={};for(const l of ls){if(skip&&pzUnit(l)===skip)continue;(adj[l.a]=adj[l.a]||[]).push(l.b);(adj[l.b]=adj[l.b]||[]).push(l.a);}
const seen=new Set([from]),q=[from];while(q.length){const u=q.pop();for(const v of adj[u]||[])if(!seen.has(v)){seen.add(v);q.push(v);}}return seen;}
function pzRingOk(ls){const nb={};for(const l of ls){(nb[l.a]=nb[l.a]||new Set()).add(l.b);(nb[l.b]=nb[l.b]||new Set()).add(l.a);}
const ns=Object.keys(nb);if(ns.length<3||!S.pz.cities.every(c=>nb[c])||!Object.keys(S.pops).every(c=>nb[c])||!ns.every(c=>nb[c].size===2))return false;
let prev=null,cur=ns[0],n=0;do{const nx=[...nb[cur]].find(x=>x!==prev);prev=cur;cur=nx;n++;}while(cur!==ns[0]&&n<=ns.length);return cur===ns[0]&&n===ns.length;}
function pzEval(){const P=S.pz,ls=S.links,cs=P.cities,spend=pzSpend();
// The checklist ticks the goal cities that are already joined up: the group holding the most of them.
let best=new Set();for(const c of cs){if(!S.pops[c]||best.has(c))continue;const g=pzComp(ls,null,c);if(cs.filter(x=>g.has(x)).length>cs.filter(x=>best.has(x)).length)best=g;}
const joined=cs.filter(c=>best.has(c)).length>=2?best:new Set();
const marks=cs.map(c=>({c,st:joined.has(c)?2:S.pops[c]?1:0}));
const conn=cs.every(c=>joined.has(c));
const tw=[];if(P.noSub)tw.push({k:'sub',ok:!S.links.some(l=>l.sub)});
if(P.ring)tw.push({k:'ring',ok:pzRingOk(ls)});
if(P.lat){const ms=S.pops[P.lat[0]]&&S.pops[P.lat[1]]?bestLat(P.lat[0],P.lat[1]):Infinity;tw.push({k:'lat',ok:ms<=P.lat[2],ms});}
if(P.minG)tw.push({k:'g',ok:ls.every(l=>LT[l.tier].g>=P.minG)});
if(P.avoid.length)tw.push({k:'avoid',ok:P.avoid.every(c=>!S.pops[c])});
const goal=conn&&tw.every(t=>t.ok),units=[...new Set(ls.map(pzUnit))];
// N-1: the goal cities stay joined whichever single trench or cable segment is cut.
const weak=conn?units.filter(u=>{const g=pzComp(ls,u,cs[0]);return !cs.every(c=>g.has(c));}):[];
const n1=conn&&units.length>0&&!weak.length,cheap=!P.budget||spend<=P.budget;
return {marks,conn,tw,goal,spend,cheap,n1,weak,stars:goal?1+(cheap?1:0)+(n1?1:0):0};}
// ---------- the weekly puzzle: the same for everyone, seeded by the ISO week like the weekly challenge ----------
function pzWeekKey(dt){const {y,w}=isoWeek(dt);return `${y}-W${String(w).padStart(2,'0')}`;}
function pzPrevKey(key){const m=/^(\d{4})-W(\d{2})$/.exec(key);if(!m)return null;return pzWeekKey(new Date(+m[1],0,4+(+m[2]-2)*7));}
function pzWeekly(dt){const key=pzWeekKey(dt||new Date());let r=hstr('puzzle|'+key)||1;const nx=()=>{r=(Math.imul(r,1103515245)+12345)>>>0;return r/4294967296;};
const pool=PZ_WEEK_POOLS[Math.floor(nx()*PZ_WEEK_POOLS.length)].slice(),n=4+Math.floor(nx()*2),cities=[];
while(cities.length<n&&pool.length)cities.push(pool.splice(Math.floor(nx()*pool.length),1)[0]);
// The budget is a ring through the cities, nearest first, on the cheapest 10G route of each hop, plus 10%:
// a ring survives any single cut, so three stars are always possible.
const ring=[cities[0]],left=cities.slice(1);while(left.length){const u=ring[ring.length-1];left.sort((a,b)=>kmBetween(u,a)-kmBetween(u,b));ring.push(left.shift());}
let cost=cities.reduce((a,c)=>a+pzPopCost(c),0);for(let i=0;i<ring.length;i++)cost+=Math.min(...pzRoutes(ring[i],ring[(i+1)%ring.length]).map(x=>pzLinkCost(x,0,false)));
return {id:'weekly',key,cities,via:[],budget:Math.ceil(cost*1.1/10000)*10000,ref:ring};}
function pzStreak(p,key){const st=p.streak;if(st.last===key)return;st.n=st.last&&st.last===pzPrevKey(key)?st.n+1:1;st.last=key;st.best=Math.max(st.best,st.n);}
function pzShareText(e){const P=S.pz;return tr('puzzles.share_line',{what:P.id==='weekly'?P.key:pzName(pzDef(P.id)),stars:pzStarStr(e.stars),spend:fmt$(e.spend)});}
// ---------- entering and leaving ----------
// The running game gets its usual save first, so leaving the puzzle can load it back exactly as booting does. A huge
// save is compressed in the background and may not have landed yet, so the game object is kept in memory too.
function pzFlush(){save(true);UI.pzKeep=UI.gzBusy||saveFailing()?S:null;}
function pzBegin(def){if(!def)return;
const go=()=>{newGame(pzName(def),def.cities[0]);S.pops={};S.mode='puzzle';S.nextFail=S.nextEvent=1e9;S.tut=null;
S.pz={id:def.id,key:def.key||null,cities:def.cities.slice(),via:(def.via||[]).slice(),avoid:(def.avoid||[]).slice(),budget:def.budget||0,noSub:!!def.noSub,ring:!!def.ring,minG:def.minG||0,lat:def.lat?def.lat.slice():null};
UI.pzHist=[];UI.pzTop=0;UI.speed=0;UI.resumeSpeed=null;UI.started=true;UI.sel=null;UI.leftOpen=false;UI.confirm=null;UI._pzh=null;
$('dash').hidden=true;$('bankBox').hidden=true;closeModal();document.body.classList.add('pz');
compute();pzCam();renderAll();track('puzzle_'+def.id);
toast(`<b>${esc(pzName(def))}</b><br>${tr('puzzles.connect_list',{list:def.cities.map(c=>CITY[c].name).join(', ')})}`,'goal');};
if(pzOn()){go();return;}
const live=!!(S&&UI.started&&!S.lost);UI.pzFrom=live?'game':'title';
if(live)pzFlush();go();}
function pzLeave(){const from=UI.pzFrom;document.body.classList.remove('pz');UI.sel=null;UI.pzHist=null;UI.pzFrom=null;closeModal();$('panel').hidden=true;$('pzBox').hidden=true;S=null;R=emptyR();UI.started=false;
if(from==='game'){const sv=UI.pzKeep||loadSave();UI.pzKeep=null;
if(sv){try{S=migrate(sv);compute();UI.started=true;UI.speed=[0,0.5,1,2,4,8].includes(S.uiSpeed)?S.uiSpeed:1;if(S.cam&&isFinite(S.cam.x))Object.assign(cam,S.cam);renderAll();return;}catch(e){S=null;UI.started=false;}}}
renderAll();showTitle();}
// The camera frames the puzzle's cities, leaving room for the puzzle card (left on wide screens, a bottom sheet on phones).
function pzCam(){const cs=[...S.pz.cities,...S.pz.via].map(c=>CITY[c]),x0=cs[0].x;let a=Infinity,b=-Infinity,c=Infinity,d=-Infinity;
for(const C of cs){const x=x0+wrapDx(x0,C.x);a=Math.min(a,x);b=Math.max(b,x);c=Math.min(c,C.y);d=Math.max(d,C.y);}
const ph=isPhone(),pl=ph?0:330,pb=ph?Math.min(230,CH*0.4):0,aw=Math.max(120,CW-pl-90),ah=Math.max(120,CH-pb-150);
cam.z=clamp(Math.min(aw/Math.max(40,b-a),ah/Math.max(40,d-c)),0.5,4);cam.x=(a+b)/2-pl/2/cam.z;cam.y=(c+d)/2+(pb/2-30)/cam.z;wrapCam();}
// ---------- building ----------
function pzSnap(){const h=UI.pzHist||(UI.pzHist=[]);h.push(JSON.stringify({p:S.pops,l:S.links}));if(h.length>60)h.shift();}
const pzNewPop=()=>({day:0,bb:null,boost:0,down:0,routers:1,gen:false});
function pzAfter(){if(UI.sel&&((UI.sel.type==='link'&&!S.links.some(l=>l.id===UI.sel.id))||(UI.sel.type==='city'&&!pzKind(UI.sel.id))))UI.sel=null;
compute();renderAll();pzCheck();}
// Stars count the moment they are earned: a better result than this attempt has had opens the results card.
function pzCheck(){const e=pzEval();if(e.stars<=(UI.pzTop||0))return e;const prev=UI.pzTop||0;UI.pzTop=e.stars;pzRecord(e);pzResults(e,prev);return e;}
function pzRecord(e){const p=pzLoad(),P=S.pz,bag=P.id==='weekly'?p.wk:p.s,k=P.id==='weekly'?P.key:P.id,r=bag[k]||{st:0,sp:null};
r.st=Math.max(r.st,e.stars);r.sp=r.sp==null?e.spend:Math.min(r.sp,e.spend);bag[k]=r;if(P.id==='weekly')pzStreak(p,P.key);pzStore(p);}
// The next puzzle in the list whose pack is open.
function pzNextDef(){const p=pzLoad(),i=PZ.findIndex(x=>x.id===S.pz.id);for(let j=i+1;j<PZ.length;j++)if(pzPackOpen(PZ[j].pack,p))return PZ[j];return null;}

View file

@ -4,6 +4,8 @@ const num=(v,d=0)=>{v=+v;return Number.isFinite(v)?v:d;},int=(v,lo,hi,d)=>{v=Mat
/* Saves come from localStorage or from imported files, so treat them as untrusted: fill in anything
missing, drop references to cities, networks or types that do not exist, and force numbers to be numbers. */
function sanitize(s){
// A puzzle is never saved; a save that says otherwise is played as a normal game.
if(s.mode==='puzzle')s.mode='normal';delete s.pz;
const arr=k=>{if(!Array.isArray(s[k]))s[k]=[];},obj=k=>{if(!s[k]||typeof s[k]!=='object'||Array.isArray(s[k]))s[k]={};};
['links','nni','transit','pni','caches','biz','offers','inc','usedNames','loans','loanOffers','hist','log'].forEach(arr);
['pops','ixp','rs','peers','myIx','done','ev','stats','ixn','ixPref','ixSite','confReg','ach','pairMet'].forEach(obj);

View file

@ -1,13 +1,13 @@
/* ================= ACTIONS ================= */
function spend(c){if(S.cash<c){toast(tr('interface.not_enough_cash_wait_for_revenue'),'bad');sfx('err');return false;}S.cash-=c;sfx('build');return true;}
const ACT={
speed:({v})=>{v=+v;if(![0,0.5,1,2,4,8].includes(v))return;if(v)UI.lastSpeed=v;UI.speed=v;renderHUD();},
speed:({v})=>{v=+v;if(pzOn())return;if(![0,0.5,1,2,4,8].includes(v))return;if(v)UI.lastSpeed=v;UI.speed=v;renderHUD();},
help:()=>showHelp(),
dash:()=>{if(!S)return;const d=$('dash');d.hidden=!d.hidden;if(!d.hidden)renderDash();},
dash:()=>{if(!S||pzOn())return;const d=$('dash');d.hidden=!d.hidden;if(!d.hidden)renderDash();},
dashClose:()=>{$('dash').hidden=true;},
dashTab:({k})=>{if(!DTABS.includes(k))return;UI.dtab=k;renderDash();const d=$('dash');if(d)d.scrollTop=0;},
dashSort:({k})=>{if(!['name','asn','type','traffic','cost','lost'].includes(k))return;if(UI.dashSort===k)UI.dashDir=-(UI.dashDir||-1);else{UI.dashSort=k;UI.dashDir=k==='name'||k==='type'||k==='asn'?1:-1;}renderDash();},
bank:()=>{if(!S)return;UI.confirm=null;$('dash').hidden=true;const b=$('bankBox');b.hidden=false;UI._bh=null;renderBank();},
bank:()=>{if(!S||pzOn())return;UI.confirm=null;$('dash').hidden=true;const b=$('bankBox');b.hidden=false;UI._bh=null;renderBank();},
bankClose:()=>{UI.confirm=null;$('bankBox').hidden=true;},
takeLoan:({id})=>{const o=S.loanOffers.find(x=>x.id===id);if(!o)return;S.stats.loans=(S.stats.loans||0)+1;const B=BANKS[o.bank];let got=o.amount,note='';
if(B.crypto){const f=0.55+Math.random()*0.8;got=Math.round(o.amount*f);note=' '+(f>=1?tr('interface.tubecoin_moved_up_p_on_the',{p:Math.round(Math.abs(f-1)*100)}):tr('interface.tubecoin_moved_down_p_on_the',{p:Math.round(Math.abs(f-1)*100)}));}
@ -33,8 +33,8 @@ const ACT={
meetGo:({city})=>{if(!isCity(city))return;$('dash').hidden=true;ACT.focusCity({city});if(S.pops[city]){UI.tab='peer';renderPanel();}},
toggleLeft:()=>{UI.leftOpen=!UI.leftOpen;renderLeft();},
phoneTab:({t})=>{if(!['goals','deals','noc','nets'].includes(t))return;haptic(8);if(UI.leftOpen&&UI.left===t&&!UI.sel){UI.leftOpen=false;}else{UI.left=t;UI.leftOpen=true;UI.sel=null;renderPanel();}$('left').classList.remove('full');renderLeft();},
phonePlay:()=>{haptic(10);if(UI.speed){UI.lastSpeed=UI.speed;UI.speed=0;}else UI.speed=UI.lastSpeed||1;renderHUD();},
phoneSpeed:()=>{haptic(8);const cur=UI.speed||UI.lastSpeed||1,i=SPEEDS.indexOf(cur),n=SPEEDS[(i+1)%SPEEDS.length];UI.speed=n;UI.lastSpeed=n;renderHUD();},
phonePlay:()=>{if(pzOn())return;haptic(10);if(UI.speed){UI.lastSpeed=UI.speed;UI.speed=0;}else UI.speed=UI.lastSpeed||1;renderHUD();},
phoneSpeed:()=>{if(pzOn())return;haptic(8);const cur=UI.speed||UI.lastSpeed||1,i=SPEEDS.indexOf(cur),n=SPEEDS[(i+1)%SPEEDS.length];UI.speed=n;UI.lastSpeed=n;renderHUD();},
install:()=>{if(installEvt){installEvt.prompt();installEvt.userChoice.finally(()=>{installEvt=null;});return;}
openModal(pitchHtml(false));},
pitchSkip:()=>{const p=UI.pendGame;UI.pendGame=null;UI.pitched=true;if(p)beginGame(...p);else closeModal();},

View file

@ -13,7 +13,7 @@ Object.assign(ACT,{
exportSave:()=>exportSave(),
importPick:()=>{let f=$('importIn');if(!f){f=document.createElement('input');f.type='file';f.accept='.json,application/json';f.id='importIn';f.hidden=true;document.body.appendChild(f);f.addEventListener('change',()=>{importFile(f.files[0]);f.value='';});}f.click();},
importGo:()=>{const s0=UI.importing;if(!s0)return;UI.importing=null;const prev=S;try{S=migrate(JSON.parse(JSON.stringify(s0)));compute();checkGoals();renderAll();}catch(e){S=prev;if(S)compute();renderAll();toast(tr('game_and_settings.import_failed_that_save_is_damaged'),'bad');sfx('err');return;}UI.confirm=null;$('bankBox').hidden=true;$('dash').hidden=true;UI.started=true;UI.sel=null;UI.speed=S.uiSpeed===undefined?1:S.uiSpeed;if(S.cam&&isFinite(S.cam.x))Object.assign(cam,S.cam);else{const h=CITY[S.home];if(h){cam.x=h.x;cam.y=h.y;}}closeModal();$('modal').hidden=true;compute();renderAll();save();toast(tr('game_and_settings.welcome_back_name_imported_and_saved',{name:esc(S.name)}),'good');sfx('coin');track('game_import');},
menu:()=>{if(!S||!UI.started){showTitle();return;}openModal(`<div style="display:flex;align-items:center"><div><div class="eyebrow">AS${S.asn} · ${esc(dateStr(S.day))} · ${tierLabel()}</div><h2 style="font-size:28px">${esc(S.name)}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
menu:()=>{if(!S||!UI.started){showTitle();return;}if(pzOn()){pzMenu();return;}openModal(`<div style="display:flex;align-items:center"><div><div class="eyebrow">AS${S.asn} · ${esc(dateStr(S.day))} · ${tierLabel()}</div><h2 style="font-size:28px">${esc(S.name)}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
${saveFailing()?`<p class="why">${saveFailMsg()}</p>`:`<p class="tagline">${tr('game_and_settings.your_game_saves_itself_every_few')}</p>`}${isPhone()?installRow():''}
<div class="menu-list">
${btn(tr('common.back_to_the_map'),'closeModal',{},'pink big')}
@ -21,6 +21,7 @@ Object.assign(ACT,{
${btn(tr('game_and_settings.import_a_save_from_a_file'),'importPick',{},'')}
${btn(tr('game_and_settings.share_your_network_image_card'),'share',{},'')}
${btn(tr('game_and_settings.scenarios_amp_weekly_challenge'),'scenarios',{},'ghost')}
${btn(tr('puzzles.puzzles'),'puzzleMenu',{},'ghost')}
${btn(tr('common.how_to_play'),'help',{},'ghost')}
${RELEASE_NOTES.length?btn(tr('common.what_s_new_in_v',{v:esc(APP_VERSION)}),'whatsNewShow',{},'ghost'):''}
${btn(tr('common.settings'),'settings',{},'ghost')}

View file

@ -0,0 +1,26 @@
Object.assign(ACT,{
// The puzzle list. The ruleset's title-screen door calls this.
puzzleMenu:()=>{if(S&&UI.started&&!pzOn())UI.nm=S.name;pzMenu();},
pzStart:({id})=>{const d=pzDef(id);if(!d||!pzPackOpen(d.pack))return;pzBegin(d);},
pzWeekly:()=>pzBegin(pzWeekly()),
pzRetry:()=>{if(!pzOn())return;pzBegin(S.pz.id==='weekly'?pzWeekly():pzDef(S.pz.id));},
pzLeave:()=>{if(pzOn())pzLeave();},
pzPop:({city})=>{if(!pzOn()||S.pops[city]||!['goal','via'].includes(pzKind(city)))return;pzSnap();S.pops[city]=pzNewPop();sfx('build');haptic(10);floater(CITY[city].x,CITY[city].y-30,tr('common.new_pop'),'#FF4F9A');pzAfter();},
pzRmPop:({city})=>{if(!pzOn()||!S.pops[city])return;pzSnap();delete S.pops[city];S.links=S.links.filter(l=>l.a!==city&&l.b!==city);sfx('click');UI.sel=null;pzAfter();},
pzLinkTo:({a,b})=>{if(!pzOn()||!S.pops[a]||a===b)return;pzLinkModal(a,b);},
pzVia:({v})=>{const p=UI.pending;if(!pzOn()||!p)return;UI.pzVia=v;pzLinkModal(p.a,p.b,true);},
pzDiv:({v})=>{const p=UI.pending;if(!pzOn()||!p)return;UI.pzDiv=!!+v;pzLinkModal(p.a,p.b,true);},
pzLink:({tier})=>{tier=+tier;const p=UI.pending;if(!pzOn()||!p||!PZ_TIERS.includes(tier))return;const {a,b}=p;if(!S.pops[a]||!['goal','via'].includes(pzKind(b)))return;
const r=pzRoutes(a,b).find(x=>x.via===UI.pzVia);if(!r||(S.pz.noSub&&r.sub)||subWaveWhy(tier,r.km,r.sub))return;
const same=!r.sub&&UI.pzDiv===false?S.links.find(l=>edgeKey(l)===edgeKey({a,b})&&!l.cable):null,div=!r.sub&&!same&&S.links.some(l=>edgeKey(l)===edgeKey({a,b})&&!l.cable);
pzSnap();if(!S.pops[b])S.pops[b]=pzNewPop();const id=uid(),f=r.f*(div?DIVERSE:1);
S.links.push({id,a,b,kind:'wave',border:false,premium:false,tier,km:r.km,sub:r.sub,cable:r.cab,mo:pzMo(r,tier,div),mult:f,trench:r.cab?'cab:'+r.cab:same?(same.trench||same.id):id,cut:0,day:0});
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,tr('links.wave_lit',{wave:LT[tier].n}),'#FF4F9A');UI.sel=null;pzAfter();},
pzTier:({id,tier})=>{tier=+tier;const l=pzOn()&&S.links.find(x=>x.id===id);if(!l||!PZ_TIERS.includes(tier)||l.tier===tier||subWaveWhy(tier,l.km,l.sub))return;pzSnap();l.tier=tier;l.mo=pzMo({km:l.km,sub:l.sub,f:l.mult||1},tier,false);sfx('build');pzAfter();},
pzRmLink:({id})=>{if(!pzOn()||!S.links.some(l=>l.id===id))return;pzSnap();S.links=S.links.filter(l=>l.id!==id);sfx('click');UI.sel=null;pzAfter();},
pzUndo:()=>{const h=UI.pzHist;if(!pzOn()||!h||!h.length)return;const o=JSON.parse(h.pop());S.pops=o.p;S.links=o.l;sfx('click');pzAfter();},
pzReset:()=>{if(!pzOn())return;pzSnap();S.pops={};S.links=[];UI.sel=null;sfx('click');pzAfter();},
pzShare:()=>{if(!pzOn())return;const t=pzShareText(pzEval());
const copied=()=>toast(tr('puzzles.copied_paste_it_anywhere',{t:esc(t)}),'good'),copy=()=>{try{navigator.clipboard.writeText(t).then(copied,()=>toast(esc(t),''));}catch(e){toast(esc(t),'');}};
if(navigator.share&&isPhone()){navigator.share({text:t}).catch(()=>{});return;}copy();track('puzzle_share');},
});

View file

@ -2,7 +2,8 @@
/* A network too big for the browser's storage fails to save every time, and turning it into text takes a
moment on huge saves, every 5 seconds and after every click. After a failure the autosave waits before trying
again (1 minute, then 2, 4, at most 5); leaving the page, exporting or another game (a new S) still try at once. */
function save(force){if(!S||S.lost)return;S.uiSpeed=UI.speed;S.cam={x:cam.x,y:cam.y,z:cam.z};const f=UI.saveFail;
// A puzzle is never saved: only its stars are, under their own key (sot-puzzles).
function save(force){if(!S||S.lost||S.mode==='puzzle')return;S.uiSpeed=UI.speed;S.cam={x:cam.x,y:cam.y,z:cam.z};const f=UI.saveFail;
if(!force&&f&&f.s===S&&performance.now()-f.at<f.wait){UI.lastSave=performance.now();return;}
const txt=JSON.stringify(packSave(S));
const seq=UI.saveSeq=(UI.saveSeq||0)+1;
@ -25,7 +26,7 @@ const unb64=t=>{const s=atob(t),u=new Uint8Array(s.length);for(let i=0;i<s.lengt
const gzip=async txt=>GZ+b64(await gzPipe(new TextEncoder().encode(txt),new CompressionStream('gzip')));
const gunzip=async raw=>new TextDecoder().decode(await gzPipe(unb64(raw.slice(GZ.length)),new DecompressionStream('gzip')));
function gzSave(s,txt,seq){if(UI.gzBusy){UI.gzNext={s,txt,seq};return;}UI.gzBusy=true;
gzip(txt).then(v=>{if(s!==S||seq!==UI.saveSeq)return;try{localStorage.setItem('sot-save-v1',v);UI.saveFail=null;}catch(e){saveErr(e,s);}})
gzip(txt).then(v=>{if((s!==S&&s!==UI.pzKeep)||seq!==UI.saveSeq)return;try{localStorage.setItem('sot-save-v1',v);UI.saveFail=null;}catch(e){saveErr(e,s);}})
.catch(e=>{console.error('[tubes] compressing the save failed',e);})
.finally(()=>{UI.gzBusy=false;const n=UI.gzNext;UI.gzNext=null;if(n&&n.s===S)gzSave(n.s,n.txt,n.seq);});}
// A compressed save is unpacked before the game boots, so loadSave() stays synchronous for everything else.
@ -52,7 +53,7 @@ document.addEventListener('visibilitychange',()=>{if(document.visibilityState===
/* Export / import: move a network to another device or keep a backup. The file is the same
object the autosave writes, wrapped with a little metadata. */
function saveFileName(){const d=new Date().toISOString().slice(0,10),n=(S&&S.name||'network').toLowerCase().replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'network';return `series-of-tubes-${n}-${d}.json`;}
function exportSave(){if(!S)return;save(true);const blob=new Blob([JSON.stringify({app:'series-of-tubes',version:APP_VERSION,exported:new Date().toISOString(),S:packSave(S)},null,1)],{type:'application/json'});
function exportSave(){if(!S||S.mode==='puzzle')return;save(true);const blob=new Blob([JSON.stringify({app:'series-of-tubes',version:APP_VERSION,exported:new Date().toISOString(),S:packSave(S)},null,1)],{type:'application/json'});
const a=document.createElement('a');a.href=URL.createObjectURL(blob);a.download=saveFileName();document.body.appendChild(a);a.click();setTimeout(()=>{URL.revokeObjectURL(a.href);a.remove();},1000);
toast(tr('save.save_exported_file_is_in_your',{file:esc(saveFileName())}),'good');}
function parseSave(txt){if(typeof txt!=='string')return {err:tr('save.that_file_is_not_valid_json')};let j;try{j=JSON.parse(txt);}catch(e){return {err:tr('save.that_file_is_not_valid_json')};}

View file

@ -7,6 +7,8 @@ function sfx(k){if(UI.muted||!AC)return;try{
else if(k==='build'){tone(523,0,.07,'triangle',.08);tone(784,.06,.12,'triangle',.08);}
else if(k==='err'){tone(180,0,.18,'sawtooth',.04);}
else if(k==='alert'){tone(880,0,.1,'square',.04);tone(660,.12,.1,'square',.04);tone(880,.24,.12,'square',.04);}
else if(k==='star'){tone(784,0,.09,'triangle',.07);tone(1175,.08,.2,'triangle',.07);}
else if(k==='fanfare'){tone(523,0,.12,'triangle',.07);tone(659,.12,.12,'triangle',.07);tone(784,.24,.12,'triangle',.07);tone(1047,.36,.35,'triangle',.08);}
else if(k==='click'){tone(660,0,.04,'triangle',.05);}
}catch(e){}}

View file

@ -22,6 +22,6 @@ function morphKids(a,b){let x=a.firstChild,y=b.firstChild;
else if(x.nodeValue!==y.nodeValue)x.nodeValue=y.nodeValue;
x=x&&x.nextSibling;y=ny;}
while(x){const nx=x.nextSibling;a.removeChild(x);x=nx;}}
function renderAll(){if(isTablet()&&!UI.sel)UI.leftOpen=false;renderHUD();renderLeft();renderPanel();renderHint();renderMega();renderCoach();}
function renderAll(){if(isTablet()&&!UI.sel)UI.leftOpen=false;renderHUD();renderLeft();renderPanel();renderHint();renderMega();renderCoach();pzRender();}
function renderMega(){const el=$('mega');if(!el)return;const on=!!(S&&S.ev&&S.ev.php>S.day);if(el.hidden===!on)return;el.hidden=!on;}

View file

@ -1,7 +1,7 @@
/* ================= PHONE ================= */
const isPhone=()=>innerWidth<=760||(innerHeight<=500&&matchMedia('(pointer:coarse)').matches);
const SPEEDS=[0.5,1,2,4,8];
function renderTabbar(){const tb=$('tabbar');if(!tb||(pressing&&UI.ticking))return;if(!isPhone()||!S||!UI.started){tb.hidden=true;document.body.classList.remove('sheet-open');return;}tb.hidden=false;
function renderTabbar(){const tb=$('tabbar');if(!tb||(pressing&&UI.ticking))return;if(!isPhone()||!S||!UI.started||pzOn()){tb.hidden=true;document.body.classList.toggle('sheet-open',pzOn()&&isPhone()&&!!UI.sel);return;}tb.hidden=false;
const open=UI.leftOpen&&!UI.sel,cur=UI.left||'goals',ndone=GOALS.filter(g=>S.done[g.id]!==undefined).length;
const tab=(k,ic,l,cnt,red)=>`<button class="${open&&cur===k?'on':''}" data-act="phoneTab" data-args='{"t":"${k}"}' aria-label="${esc(l)}"><span class="ic" aria-hidden="true">${ic}</span>${esc(l)}${cnt?`<span class="cnt${red?' red':''}">${cnt}</span>`:''}</button>`;
const h=`<button class="play${UI.speed?'':' paused'}" data-act="phonePlay" aria-label="${UI.speed?tr('common.pause'):tr('common.play')}"><span class="ic" aria-hidden="true">${UI.speed?'❚❚':'▶'}</span>${UI.speed?tr('common.pause'):tr('common.play')}</button>`+
@ -15,7 +15,8 @@ function haptic(ms){if(UI.muted)return;try{navigator.vibrate&&navigator.vibrate(
document.addEventListener('pointerdown',e=>{const h=e.target.closest('[data-grab]');if(!h||!isPhone())return;const el=h.parentElement;g={el,y:e.clientY,dy:0,id:e.pointerId,full:el.classList.contains('full')};try{h.setPointerCapture(e.pointerId);}catch(_){}el.style.transition='none';});
document.addEventListener('pointermove',e=>{if(!g||e.pointerId!==g.id)return;g.dy=e.clientY-g.y;if(g.dy>0)g.el.style.transform=`translateY(${g.dy}px)`;});
const end=e=>{if(!g||e.pointerId!==g.id)return;const {el,dy,full}=g;g=null;el.style.transition='';el.style.transform='';
if(Math.abs(dy)<6){el.classList.toggle('full');return;}
if(Math.abs(dy)<6){el.classList.toggle(el.id==='pzBox'?'mini':'full');return;}
if(el.id==='pzBox'){el.classList.toggle('mini',dy>0);return;}
if(dy<-40){el.classList.add('full');return;}
if(dy>40){if(full){el.classList.remove('full');return;}if(el.id==='panel')ACT.closePanel();else{UI.leftOpen=false;renderLeft();}}};
document.addEventListener('pointerup',end);document.addEventListener('pointercancel',end);})();

View file

@ -5,6 +5,7 @@ function renderHUD(){
for(const v of [0,0.5,1,2,4,8]){const b=$('sp'+v);if(b)b.classList.toggle('on',UI.speed===v);}
$('muteBtn').style.opacity=UI.muted?.4:1;
if(!S)return;
if(pzOn()){$('hName').textContent=pzName(pzDef(S.pz.id)||S.pz);$('hAsn').textContent=tr('puzzles.puzzle');renderTabbar();return;}
$('hName').textContent=S.name;$('hAsn').textContent='AS'+S.asn+(S.mode==='sandbox'?' · '+tr('common.sandbox'):S.scn?' · '+(scnName())+(S.scn.done||S.scn.failed?'':` · ${tr('ui.n_d_left',{n:Math.max(0,S.scn.days-S.day)})}`):'');
$('hCash').textContent=fmt$(S.cash);$('hCash').style.color=S.cash<0?'var(--bad)':'';
const net=R.revMo-R.costMo;$('hRate').innerHTML=`<span class="${net>=0?'up':'down'}">${net>=0?'▲':'▼'} ${tr('common.price_mo',{price:fmt$(Math.abs(net))})}</span>`;
@ -26,7 +27,7 @@ function renderLeft(){checkLayer();
// while a city or link is open and comes back with the toggle button.
const tab=isTablet(),L=$('left');L.classList.toggle('closed',tab?(!!UI.sel&&!UI.leftOpen):!UI.leftOpen);const tg=$('leftToggle');if(tg&&innerWidth>760)tg.hidden=!(tab&&L.classList.contains('closed'));
renderTabbar();
if(!S){L.hidden=true;return;}L.hidden=false;
if(!S||pzOn()){L.hidden=true;return;}L.hidden=false;
const ndone=GOALS.filter(g=>S.done[g.id]!==undefined).length;
const tabs=[['goals',`${tr('common.goals')}<span class="cnt">${ndone}/${GOALS.length}</span>`],['deals',`${tr('common.deals')}${S.offers.length?`<span class="cnt">${S.offers.length}</span>`:''}`],['noc',`NOC${S.inc.length?`<span class="cnt red">${S.inc.length}</span>`:''}`],['nets',`${tr('common.networks')}${ibxOpen()?`<span class="cnt${ibxUrgent()?' red':''}">${ibxOpen()}</span>`:''}`]];
$('leftTabs').innerHTML=tabs.map(([k,l])=>`<button class="${UI.left===k?'on':''}" data-act="leftTab" data-args='{"t":"${k}"}'>${l}</button>`).join('')+(innerWidth<760?`<button data-act="toggleLeft" style="margin-left:auto" aria-label="${tr('common.close')}">×</button>`:'');
@ -86,6 +87,6 @@ function renderPanel(){checkLayer();
if(!S||!UI.sel){P.hidden=true;return;}
P.hidden=false;
const scrollEl=$('panelBody').querySelector('.scroll');const st=scrollEl?scrollEl.scrollTop:0;
const html=UI.sel.type==='city'?cityPanel(UI.sel.id):linkPanel(UI.sel.id);if(html===UI._ph&&!P.hidden&&$('panelBody').firstChild)return;UI._ph=html;morph($('panelBody'),html);
const html=pzOn()?pzPanel(UI.sel):UI.sel.type==='city'?cityPanel(UI.sel.id):linkPanel(UI.sel.id);if(!html){P.hidden=true;return;}if(html===UI._ph&&!P.hidden&&$('panelBody').firstChild)return;UI._ph=html;morph($('panelBody'),html);
const ns=$('panelBody').querySelector('.scroll');if(ns)ns.scrollTop=st;
}

View file

@ -1,6 +1,7 @@
function renderHint(){
const hn=$('hint');if(!S||UI.hintOff||(S.tut!==undefined&&S.tut!==null)||(innerWidth<760&&(UI.sel||UI.leftOpen)&&!(UI.drag&&UI.drag.mode==='link'))){hn.hidden=true;return;}
let t='';
if(pzOn()){t=UI.drag&&UI.drag.mode==='link'?(UI.snap?tr('hint.release_to_plan_a_link'):tr('hint.drag_onto_another_city')):!Object.keys(S.pops).length?tr('puzzles.tap_a_goal_city_to_open'):!S.links.length?tr('puzzles.drag_from_a_pink_pop_to'):'';hn.textContent=t;hn.hidden=!t;return;}
if(UI.drag&&UI.drag.mode==='link')t=UI.snap?tr('hint.release_to_plan_a_link'):tr('hint.drag_onto_another_city');
else if(!S.links.length&&S.done.tr)t=tr('hint.tip_drag_from_your_pink_router');
else if(!S.done.bb)t=tr('hint.tap_your_city_then_launch_broadband');

View file

@ -17,7 +17,7 @@ function showTitle(){
${sv?`<div class="btns" style="margin-bottom:6px">${btn(tr('title.continue_name_date',{name:esc(sv.name),date:dateStr(sv.day)}),'cont',{},'pink big')}</div>`:''}
<label class="f" for="nmIn">${tr('title.name_your_network')}</label><div class="network-name"><input class="t" id="nmIn" maxlength="24" value="${esc(UI.nm)}" autocomplete="off">${btn(tr('common.another_one'),'randomName',{},'ghost sm')}</div>
<label class="f">${tr('title.pick_your_home_city')}</label><div class="starts homes">${starts.map(([c,d])=>`<button class="start ${UI.startCity===c?'on':''}" data-city="${c}" data-act="pickStart" data-args='{"city":"${c}"}'><b>${CITY[c].name}</b><span>${d}</span></button>`).join('')}<label class="start own ${START5.includes(UI.startCity)?'':'on'}" for="homeSel"><b>${tr('title.anywhere_else')}</b><span id="homeWhat">${homeWhat()}</span>${homePick()}</label></div>
<label class="f">${tr('common.mode')}</label><div class="btns">${[['normal',tr('common.normal')],['sandbox',tr('common.sandbox')]].map(([m,l])=>`<button class="b sm modeb ${(UI.mode||'normal')===m?'pink':'ghost'}" data-m="${m}" data-act="modeSet" data-args='{"m":"${m}"}'>${l}</button>`).join('')}${btn(tr('title.scenarios_amp_weekly_challenge'),'scenarios',{},'sm')}</div>
<label class="f">${tr('common.mode')}</label><div class="btns">${[['normal',tr('common.normal')],['sandbox',tr('common.sandbox')]].map(([m,l])=>`<button class="b sm modeb ${(UI.mode||'normal')===m?'pink':'ghost'}" data-m="${m}" data-act="modeSet" data-args='{"m":"${m}"}'>${l}</button>`).join('')}${btn(tr('title.scenarios_amp_weekly_challenge'),'scenarios',{},'sm')}${/* v2: replaced by the Puzzles door */btn(tr('puzzles.puzzles'),'puzzleMenu',{},'sm')}</div>
<label class="f" for="langTitle">${tr('common.language')}</label>${langPick('langTitle')}
<div class="btns cta tcta" style="margin-top:16px">${btn(sv?tr('common.start_a_new_network'):tr('common.start_building'),'start',{},'big')}${btn(tr('common.how_to_play'),'help',{},'ghost')}${btn(tr('common.import_a_save'),'importPick',{},'ghost')}${btn(tr('common.settings'),'settings',{},'ghost')}</div><p class="ver">v${APP_VERSION} · <a href="https://github.com/fjaeckel/seriesoftubes" target="_blank" rel="noopener">${tr('title.source_on_github')}</a> · <a href="${SIGNAL}" target="_blank" rel="noopener">${tr('title.chat_on_signal')}</a> · ${tr('title.cookieless_stats_no_tracking')}</p>`);
$('nmIn').addEventListener('input',e=>{UI.nm=e.target.value;});

View file

@ -0,0 +1,81 @@
/* ---------- puzzles: the card, the panels, the link picker, the results and the list ---------- */
const PZ_ICON={goal:'🎯',via:'🪨',avoid:'🚫'};
function pzTwistTxt(t){const P=S.pz;
if(t.k==='sub')return tr('puzzles.no_subsea_cables');
if(t.k==='ring')return tr('puzzles.one_ring_through_every_pop');
if(t.k==='g')return tr('puzzles.every_link_n_g_or_more',{n:P.minG});
if(t.k==='avoid')return tr('puzzles.no_pop_in_list',{list:P.avoid.map(c=>CITY[c].name).join(', ')});
const [a,b,ms]=P.lat;return isFinite(t.ms)?tr('puzzles.a_to_b_under_ms_now',{a:CITY[a].name,b:CITY[b].name,ms,now:t.ms.toFixed(1)}):tr('puzzles.a_to_b_under_ms',{a:CITY[a].name,b:CITY[b].name,ms});}
// The short version, for the puzzle list.
function pzTwistTag(d){const t=[];if(d.noSub)t.push(tr('puzzles.no_subsea'));if(d.ring)t.push(tr('puzzles.ring'));if(d.lat)t.push(tr('puzzles.under_n_ms',{n:d.lat[2]}));if(d.minG)t.push(tr('puzzles.n_g_links',{n:d.minG}));if(d.avoid)t.push(tr('puzzles.avoid_list',{list:d.avoid.map(c=>CITY[c].name).join(', ')}));return t;}
const pzUnitName=u=>{const l=S.links.find(x=>pzUnit(x)===u);return l?`${CITY[l.a].name} ⇄ ${CITY[l.b].name}${l.cable?' ('+esc(CAB[l.cable].name)+')':''}`:'';};
function pzRender(){const el=$('pzBox');if(!pzOn()){el.hidden=true;return;}el.hidden=false;
const e=pzEval(),P=S.pz,d=pzDef(P.id),pk=d&&PZ_PACKS.find(x=>x.id===d.pack);
const star=(on,l)=>`<span class="${on?'on':''}">⭐<small>${l}</small></span>`;
let h=`<div class="grab" data-grab="pz" aria-hidden="true"></div><div class="pzh"><div class="grow"><div class="eyebrow">${pk?esc(pk.n):tr('puzzles.weekly_puzzle')}</div><h3>${esc(pzName(d||P))}</h3></div>${btn('☰','puzzleMenu',{},'ghost sm')}</div>`;
if(d)h+=`<p class="pzj">${esc(d.j)}</p>`;
h+=`<div class="pzs">${star(e.goal,tr('puzzles.goal'))}${star(e.goal&&e.cheap,P.budget?tr('puzzles.budget'):tr('puzzles.free'))}${star(e.goal&&e.n1,'N-1')}</div>`;
h+=`<div class="pzck">${e.marks.map(m=>`<span class="pzc s${m.st}">${esc(CITY[m.c].name)}${m.st===2?' ✓':m.st===1?' ·':' …'}</span>`).join('')}</div>`;
for(const t of e.tw)h+=`<div class="pztw ${t.ok?'ok':''}">${t.ok?'✓':'✗'} ${pzTwistTxt(t)}</div>`;
const sp=fmt$(e.spend);
h+=P.budget?`<div class="pzbud"><div class="kv"><span>${tr('puzzles.spent_x_of_y',{x:sp,y:fmt$(P.budget)})}</span><b>${e.cheap?'✓':'✗'}</b></div><div class="bar ${e.cheap?(e.spend>P.budget*0.85?'warn':''):'bad'}"><i style="width:${Math.min(100,e.spend/P.budget*100).toFixed(1)}%"></i></div></div>`
:`<div class="pzbud"><div class="kv"><span>${tr('puzzles.spent_x',{x:sp})}</span><b>${tr('puzzles.no_budget_star_on_the_house')}</b></div></div>`;
h+=!e.conn?`<div class="pzn1">🛡 ${tr('puzzles.n_1_connect_everything_first')}</div>`:e.n1?`<div class="pzn1 on">🛡 ${tr('puzzles.survives_any_single_cut')}</div>`:`<div class="pzn1 bad">⚠️ ${tr('puzzles.one_cut_splits_it_where',{where:pzUnitName(e.weak[0])})}</div>`;
h+=`<div class="btns">${btn('↶ '+tr('puzzles.undo'),'pzUndo',{},'ghost sm',!(UI.pzHist&&UI.pzHist.length))}${btn(tr('puzzles.reset'),'pzReset',{},'ghost sm',!S.links.length&&!Object.keys(S.pops).length)}${btn(UI.pzFrom==='game'?tr('puzzles.back_to_my_network'):tr('puzzles.back_to_the_title'),'pzLeave',{},'ghost sm')}</div>`;
if(h!==UI._pzh){UI._pzh=h;morph(el,h);}}
function pzPanel(sel){const head=(eb,name,facts)=>`<div class="ph"><div style="min-width:0"><div class="eyebrow">${eb}</div><h2>${name}</h2>${facts?`<div class="facts">${facts}</div>`:''}</div><button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div>`;
if(sel.type==='city'){const c=sel.id,k=pzKind(c),p=S.pops[c],C=CITY[c];if(!k)return '';
const eb=k==='goal'?tr('puzzles.goal_city'):k==='via'?tr('puzzles.stepping_stone_optional'):tr('puzzles.off_limits');
let h=head(`${PZ_ICON[k]} ${eb}`,esc(C.name),p?`<span class="fact mine">${tr('common.your_pop')}</span>`:'')+'<div class="scroll">';
if(k==='avoid')return h+`<p class="lead">${tr('puzzles.not_this_one_find_a_way_around')}</p></div>`;
if(!p)h+=`<p class="lead">${tr('puzzles.a_pop_costs_setup_plus_a_year',{setup:fmt$(popCost(c)),mo:fmt$(POP_MO)})}</p><div class="btns">${btn(tr('puzzles.open_a_pop_cost',{cost:fmt$(pzPopCost(c))}),'pzPop',{city:c},'pink big')}</div>`;
else{const others=[...S.pz.cities,...S.pz.via].filter(x=>x!==c);
h+=`<p class="lead">${tr('puzzles.drag_from_this_pop_onto_another')}</p><h3>${tr('puzzles.lease_a_wave_to')}</h3><div class="seg">${others.map(x=>btn(esc(CITY[x].name),'pzLinkTo',{a:c,b:x},S.pops[x]?'':'ghost')).join('')}</div>`;
const ls=S.links.filter(l=>l.a===c||l.b===c);if(ls.length)h+=`<h3 style="margin-top:10px">${tr('common.links')}</h3>`+ls.map(l=>`<div class="row"><div class="grow"><div class="nm">${esc(CITY[l.a===c?l.b:l.a].name)}</div><div class="meta">${capName(l)} · ${linkLat(l).toFixed(1)} ms</div></div>${btn(tr('common.open'),'selLink',{id:l.id},'ghost sm')}</div>`).join('');
h+=`<div class="btns" style="margin-top:10px">${btn(tr('puzzles.remove_this_pop'),'pzRmPop',{city:c},'red sm')}</div>`;}
return h+'</div>';}
const l=S.links.find(x=>x.id===sel.id);if(!l)return '';
let h=head(l.cable?esc(CAB[l.cable].name):tr('common.overland'),`${esc(CITY[l.a].name)} ⇄ ${esc(CITY[l.b].name)}`,`<span class="fact">${capName(l)}</span><span class="fact">${l.km.toLocaleString()} km</span><span class="fact">${linkLat(l).toFixed(1)} ms</span><span class="fact">${tr('puzzles.price_per_year',{price:fmt$(l.mo*PZ_YEAR)})}</span>`)+'<div class="scroll">';
h+=`<h3>${tr('puzzles.size')}</h3><div class="seg">${PZ_TIERS.map(i=>{const r={km:l.km,sub:l.sub,f:l.mult||1},why=subWaveWhy(i,l.km,l.sub);return btn(`${LT[i].n} <small>${tr('puzzles.price_per_year',{price:fmt$(pzMo(r,i,false)*PZ_YEAR)})}</small>`,'pzTier',{id:l.id,tier:i},l.tier===i?'pink':'ghost',!!why||l.tier===i);}).join('')}</div>`;
return h+`<div class="btns" style="margin-top:10px">${btn(tr('puzzles.remove_this_link'),'pzRmLink',{id:l.id},'red sm')}</div></div>`;}
// The link picker: overland or one of the real cables between the two cities, and a size. Prices are for a year.
function pzLinkModal(a,b,keep){const kb=pzKind(b);
if(!kb||kb==='avoid'||!pzKind(a)){toast(kb==='avoid'?tr('puzzles.not_this_one_find_a_way_around'):tr('puzzles.that_city_is_not_part_of'),'bad');sfx('err');return;}
if(!keep){UI.pzVia=null;UI.pzDiv=true;}UI.pending={a,b};const rs=pzRoutes(a,b),P=S.pz;
const head=`<div style="display:flex;align-items:center"><div><div class="eyebrow">${kmBetween(a,b).toLocaleString()} km</div><h2 style="font-size:26px">${esc(CITY[a].name)} → ${esc(CITY[b].name)}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>`;
if(!rs.length){openModal(head+`<p class="lead" style="margin-top:10px">${tr('puzzles.no_cable_lands_in_both_try',{a:esc(CITY[a].name),b:esc(CITY[b].name)})}</p>`);return;}
const r=rs.find(x=>x.via===UI.pzVia)||rs.find(x=>!(P.noSub&&x.sub))||rs[0];UI.pzVia=r.via;
const land=!r.sub&&S.links.some(l=>edgeKey(l)===edgeKey({a,b})&&!l.cable),div=land&&UI.pzDiv!==false,pop=S.pops[b]?0:pzPopCost(b);
let h=head+`<h4 class="sub4">${tr('common.route')}</h4><div class="seg">${rs.map(x=>btn(`${x.cab?esc(CAB[x.cab].name):tr('common.overland')} <small>${x.ms.toFixed(1)} ms${x.cab&&CAB[x.cab].age==='old'?'':''}</small>`,'pzVia',{v:x.via},x.via===r.via?'pink':'ghost',P.noSub&&x.sub)).join('')}</div>`;
if(P.noSub&&r.sub)h+=`<p class="why">${tr('puzzles.the_sharks_say_no')}</p>`;
if(r.cab)h+=`<p class="note">${esc(CAB[r.cab].blurb)}</p>`;
if(land)h+=`<div class="seg" style="margin-top:8px">${btn(tr('puzzles.diverse_route_40_survives_a_backhoe'),'pzDiv',{v:1},div?'pink':'ghost')}${btn(tr('puzzles.same_trench_cheaper_one_backhoe_cuts'),'pzDiv',{v:0},div?'ghost':'pink')}</div>`;
if(pop)h+=`<p class="lead" style="margin-top:8px">${tr('puzzles.includes_a_new_pop_in_city',{city:esc(CITY[b].name),price:fmt$(pop)})}</p>`;
h+=`<div class="tiers">${PZ_TIERS.map(i=>{const why=subWaveWhy(i,r.km,r.sub),c=pzLinkCost(r,i,div)+pop;return `<button class="tierbtn" data-act="pzLink" data-args='{"tier":${i}}'${why||(P.noSub&&r.sub)?' disabled':''}><span class="sz">${LT[i].n}</span><span class="grow meta">${why?tr('common.too_far_for_this_cable'):pop?tr('puzzles.with_the_pop_price',{price:fmt$(c)}):''}</span><span class="pr num">${tr('puzzles.price_per_year',{price:fmt$(pzLinkCost(r,i,div))})}</span></button>`;}).join('')}</div>`;
openModal(h);}
// ---------- results ----------
function pzLine(e){return e.stars>=3?tr('puzzles.a_backhoe_walks_into_your_network'):!e.n1&&!e.cheap?tr('puzzles.it_works_finance_and_the_backhoe'):!e.n1?tr('puzzles.one_backhoe_away_from_a_very'):tr('puzzles.rock_solid_and_gold_plated_the');}
function pzConfetti(){if(!animOn())return '';const cols=['#FF4F9A','#FFD23F','#22C47A','#2F8CFF','#FF8A3D','#7B61FF'];let h='';
for(let i=0;i<28;i++)h+=`<i style="--x:${(i*37)%100}%;--c:${cols[i%cols.length]};--r:${(i%2?1:-1)*(180+(i*53)%360)}deg;--t:${1.4+(i%5)*0.25}s;--dl:${((i*7)%10)/10}s"></i>`;
return `<div class="pzconf" aria-hidden="true">${h}</div>`;}
function pzResults(e,prev){const P=S.pz,nx=P.id==='weekly'?null:pzNextDef();
const row=(ok,l,v)=>`<div class="kv"><span>${ok?'⭐':'☆'} ${l}</span><b>${v}</b></div>`;
const stars=[0,1,2].map(i=>`<span class="pzbig${i<e.stars?' on':''}${i>=prev&&i<e.stars?' pop':''}" style="--d:${Math.max(0,i-prev)*0.45}s">⭐</span>`).join('');
openModal(`<div class="pzres">${e.stars>=3?pzConfetti():''}<div style="display:flex;align-items:center"><div class="grow"><div class="eyebrow">${tr('puzzles.puzzle_solved')}</div><h2 style="font-size:28px">${esc(pzName(pzDef(P.id)||P))}</h2></div><button class="x" data-act="closeModal" aria-label="${tr('common.close')}">×</button></div>
<div class="pzstars">${stars}</div><p class="tagline" style="text-align:center">${pzLine(e)}</p>
${row(true,tr('puzzles.goal'),tr('puzzles.connected'))}${row(e.cheap,tr('puzzles.budget'),P.budget?tr('puzzles.spent_x_of_y',{x:fmt$(e.spend),y:fmt$(P.budget)}):tr('puzzles.on_the_house'))}${row(e.n1,'N-1',e.n1?tr('puzzles.survives_any_single_cut'):tr('puzzles.one_cut_splits_it'))}
<div class="btns cta" style="margin-top:12px">${nx?btn(tr('puzzles.next_puzzle'),'pzStart',{id:nx.id},'pink big'):btn(tr('puzzles.more_puzzles'),'puzzleMenu',{},'pink big')}${e.stars<3?btn(tr('puzzles.retry_for_3_stars'),'pzRetry',{},''):''}${btn(tr('common.share_2cd9'),'pzShare',{},'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}</div></div>`);
for(let i=prev;i<e.stars;i++)setTimeout(()=>{sfx('star');haptic(15);},Math.max(0,i-prev)*450+150);
if(e.stars>=3&&prev<3)setTimeout(()=>sfx('fanfare'),(3-prev)*450+250);}
// ---------- the list ----------
function pzMenu(){const p=pzLoad(),tot=pzStarsTotal(p),max=PZ.length*3,nxP=PZ_PACKS.find(x=>x.need>tot),w=pzWeekly(),wr=p.wk[w.key],st=p.streak,streak=st.last===w.key||st.last===pzPrevKey(w.key)?st.n:0;
let h=`<div style="display:flex;align-items:center"><div class="grow"><div class="eyebrow">${tr('puzzles.puzzles')}</div><h2 style="font-size:28px">${tr('puzzles.small_calm_network_builds')}</h2></div><button class="x" data-act="helpClose" aria-label="${tr('common.close')}">×</button></div>
<p class="tagline">${tr('puzzles.no_clock_no_bills_nothing_breaks')}</p>
<div class="pzprog"><div class="kv"><span>${tr('puzzles.your_stars')}</span><b>⭐ ${tot} / ${max}</b></div><div class="bar me"><i style="width:${(tot/max*100).toFixed(1)}%"></i></div>${nxP?`<div class="meta">${tr('puzzles.next_pack_unlocks_at_n',{n:nxP.need,pack:esc(nxP.n)})}</div>`:''}</div>`;
if(pzOn())h+=`<div class="btns" style="margin:8px 0">${btn(UI.pzFrom==='game'?tr('puzzles.back_to_my_network'):tr('puzzles.back_to_the_title'),'pzLeave',{},'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}</div>`;
h+=`<div class="scn wk"><div class="grow"><div class="nm">${tr('puzzles.weekly_puzzle_key',{key:esc(w.key)})} ${wr?`<span class="pzst">${pzStarStr(wr.st)}</span>`:''}</div><div class="meta">${w.cities.map(c=>esc(CITY[c].name)).join(' · ')} · ${tr('puzzles.budget_x',{x:fmt$(w.budget)})}</div><div class="meta">${tr('puzzles.same_puzzle_for_everyone_this_week')}${streak?' · 🔥 '+trn('puzzles.n_week_streak',streak):''}</div></div>${btn(tr('common.play'),'pzWeekly',{},'pink')}</div>`;
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+=`<h3 class="pzpack">${open?'':'🔒 '}${esc(pk.n)} <span class="meta">⭐ ${got}/${n*3}</span></h3><p class="meta" style="margin:0 0 2px">${open?esc(pk.d):tr('puzzles.unlocks_at_n_stars',{n:pk.need})}</p>`;
for(const d of PZ.filter(x=>x.pack===pk.id)){const r=p.s[d.id],tg=pzTwistTag(d);
h+=`<div class="scn${open?'':' lock'}"><div class="grow"><div class="nm">${esc(d.n)} <span class="pzst">${pzStarStr(r?r.st:0)}</span></div><div class="meta">${esc(d.j)}</div><div class="meta">${d.cities.map(c=>esc(CITY[c].name)).join(' · ')} · ${d.budget?tr('puzzles.budget_x',{x:fmt$(d.budget)}):tr('puzzles.no_budget')}${tg.length?' · <b>'+tg.join(' · ')+'</b>':''}${r&&r.sp!=null?' · '+tr('puzzles.best_x',{x:fmt$(r.sp)}):''}</div></div>${btn(tr('common.play'),'pzStart',{id:d.id},r&&r.st>=3?'ghost':'',!open)}</div>`;}}
openModal(h);}

View file

@ -85,7 +85,7 @@ function drawFrame(now){
// Which cities show an offer bubble (a big one?) or an incident marker, worked out once for all of them.
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;
for(const v of vis.slice().reverse())drawCity(v.C,v.sx,v.sy,sc,now,v.ly);
if(pzOn())for(const v of vis.slice().reverse())pzDrawCity(v,sc,now);else for(const v of vis.slice().reverse())drawCity(v.C,v.sx,v.sy,sc,now,v.ly);
// 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,10 @@
/* Puzzle map: the puzzle's cities stand out (goals with a pulsing ring, stepping stones with a dashed one, cities to
avoid crossed out); every other city stays on the map, faded and untappable. */
function pzDrawCity(v,sc,now){const k=pzKind(v.C.id);
if(!k){ctx.save();ctx.globalAlpha=0.3;drawCity(v.C,v.sx,v.sy,sc,now,null);ctx.restore();return;}
const r=(CM.far?16:34)*sc,y=v.sy-(CM.far?0:6*sc),p=S.pops[v.C.id];
ctx.save();ctx.lineWidth=3;
if(k==='avoid'){ctx.strokeStyle='#FF4D5E';ctx.beginPath();ctx.arc(v.sx,y,r,0,7);ctx.moveTo(v.sx-r*.7,y-r*.7);ctx.lineTo(v.sx+r*.7,y+r*.7);ctx.stroke();}
else{const a=animOn()?.55+.35*Math.sin(now/300):.8;ctx.strokeStyle=k==='goal'?`rgba(255,79,154,${p?1:a})`:'rgba(30,38,64,.7)';if(k==='via')ctx.setLineDash([5,5]);
ctx.fillStyle=k==='goal'&&!p?'rgba(255,210,63,.35)':'rgba(255,255,255,.25)';ctx.beginPath();ctx.arc(v.sx,y,r,0,7);ctx.fill();ctx.stroke();ctx.setLineDash([]);}
ctx.restore();drawCity(v.C,v.sx,v.sy,sc,now,v.ly===null?undefined:v.ly);}

View file

@ -1,5 +1,5 @@
/* ---------- hit tests & input ---------- */
function hitCity(x,y,r=28){let best=null,bd=r*iconScale();const KS=visibleKs();for(const C of CITIES){if(C.off&&!cityOn(C.id))continue;for(const k of KS){const [sx,sy]=toS(C.x,C.y,k);const d=Math.hypot(sx-x,sy+4-y);if(d<bd){bd=d;best={id:C.id,sx,sy};}}}return best;}
function hitCity(x,y,r=28){let best=null,bd=r*iconScale();const KS=visibleKs();const pz=pzOn();for(const C of CITIES){if(C.off&&!cityOn(C.id))continue;if(pz&&!pzKind(C.id))continue;for(const k of KS){const [sx,sy]=toS(C.x,C.y,k);const d=Math.hypot(sx-x,sy+4-y);if(d<bd){bd=d;best={id:C.id,sx,sy};}}}return best;}
// A tap on a city's icon picks the city; in the rest of its (generous) tap circle, a link right under the finger wins,
// or a short link between two close cities could not be picked at all (#126).
function pickCity(x,y){const h=hitCity(x,y);if(!h)return null;if(Math.hypot(h.sx-x,h.sy+4-y)<=16*iconScale())return h;return hitLink(x,y)?null:h;}
@ -25,7 +25,7 @@ cv.addEventListener('pointermove',e=>{
function endPtr(e){
ptrs.delete(e.pointerId);const d=UI.drag;if(!d)return;
if(d.mode==='pinch'){if(ptrs.size===0){UI.drag=null;UI.snap=null;cv.classList.remove('linking');}return;}
if(d.mode==='link'){if(UI.snap&&UI.snap.id!==d.from){openLinkModal(d.from,UI.snap.id);sfx('click');}}
if(d.mode==='link'){if(UI.snap&&UI.snap.id!==d.from){if(pzOn())pzLinkModal(d.from,UI.snap.id);else openLinkModal(d.from,UI.snap.id);sfx('click');}}
else if(!d.moved&&S){const h=pickCity(e.clientX,e.clientY);
if(h){selectCity(h.id);renderLeft();sfx('click');}
else{const l=hitLink(e.clientX,e.clientY);if(l){selectLink(l);sfx('click');}else{UI.sel=null;renderPanel();renderLeft();}}}
@ -38,5 +38,5 @@ cv.addEventListener('pointerup',endPtr);cv.addEventListener('pointercancel',canc
const ZMIN=0.35,ZMAX=16;
function zoomAt(mx,my,f){const wx=cam.x+(mx-CW/2)/cam.z,wy=cam.y+(my-CH/2)/cam.z;cam.z=clamp(cam.z*f,ZMIN,ZMAX);cam.x=wx-(mx-CW/2)/cam.z;cam.y=wy-(my-CH/2)/cam.z;wrapCam();}
cv.addEventListener('wheel',e=>{e.preventDefault();zoomAt(e.clientX,e.clientY,Math.exp(-e.deltaY*0.0015));},{passive:false});
addEventListener('keydown',e=>{if(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]'))return;if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.code==='Space'&&e.target.closest&&e.target.closest('button,a'))return;if(e.code==='Space'){e.preventDefault();UI.speed=UI.speed?0:1;renderHUD();}if(e.key==='0')ACT.speed({v:0.5});if(e.key==='1')ACT.speed({v:1});if(e.key==='2')ACT.speed({v:2});if(e.key==='3')ACT.speed({v:4});if(e.key==='4')ACT.speed({v:8});if(e.key==='Escape'&&!$('bankBox').hidden){$('bankBox').hidden=true;return;}if(e.key==='Escape'&&!$('dash').hidden){$('dash').hidden=true;return;}if(e.key==='Escape'){if(!$('modal').hidden){if(S&&UI.started&&!S.lost)closeModal();}else{UI.sel=null;renderPanel();}}});
addEventListener('keydown',e=>{if(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]'))return;if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.code==='Space'&&e.target.closest&&e.target.closest('button,a'))return;if(e.code==='Space'){e.preventDefault();if(!pzOn()){UI.speed=UI.speed?0:1;renderHUD();}}if(e.key==='0')ACT.speed({v:0.5});if(e.key==='1')ACT.speed({v:1});if(e.key==='2')ACT.speed({v:2});if(e.key==='3')ACT.speed({v:4});if(e.key==='4')ACT.speed({v:8});if(e.key==='Escape'&&!$('bankBox').hidden){$('bankBox').hidden=true;return;}if(e.key==='Escape'&&!$('dash').hidden){$('dash').hidden=true;return;}if(e.key==='Escape'){if(!$('modal').hidden){if(S&&UI.started&&!S.lost)closeModal();}else{UI.sel=null;renderPanel();}}});

View file

@ -1,6 +1,6 @@
/* ---------- click delegation ---------- */
let pressing=false;
document.addEventListener('pointerdown',e=>{if(e.target.closest('#panel,#left,#dash,#bankBox,#modal,#tabbar,#toasts'))pressing=true;});
document.addEventListener('pointerdown',e=>{if(e.target.closest('#panel,#left,#dash,#bankBox,#modal,#tabbar,#toasts,#pzBox'))pressing=true;});
addEventListener('pointerup',()=>setTimeout(()=>pressing=false,0));
addEventListener('pointercancel',()=>{pressing=false;});addEventListener('blur',()=>{pressing=false;});
document.addEventListener('change',e=>{const el=e.target.closest('[data-chg]');if(!el||(!S&&!['langSet','pickHome'].includes(el.dataset.chg)))return;const fn=ACT[el.dataset.chg];if(fn)fn({v:el.value});});
@ -11,5 +11,5 @@ let PD={t:0,b:null};
document.addEventListener('pointerdown',e=>{PD={t:performance.now(),b:e.target.closest('[data-act]')};},true);
function tapOk(e,b){if(!e.isTrusted||!PD.t||e.detail===0)return true;const now=performance.now();if(now-PD.t>4000)return true;
if(PD.b!==b)return false;if((UI.layerAt||0)>PD.t)return false;const ts=b.closest('.toast');if(ts&&PD.t-(+ts.dataset.born||0)<500)return false;return true;}
document.addEventListener('click',e=>{const b=e.target.closest('[data-act]');if(!b||b.disabled)return;if(!$('modal').hidden&&!b.closest('#modal'))return;if(!tapOk(e,b))return;audioInit();const fn=ACT[b.dataset.act];if(!fn)return;if(!S&&!['start','randomName','pickStart','cont','help','helpClose','newgame','mute','animSet','soundSet','langSet','closeModal','speed','bankClose','whatsNewShow','updateNow','updateLater','importPick','importGo','modeSet','scenarios','startScn','startWeekly','settings','settingsClose','prefSet','vpSet','install','pitchSkip'].includes(b.dataset.act))return;let a={};try{a=JSON.parse(b.dataset.args||'{}');}catch(_){}fn(a);});
document.addEventListener('click',e=>{const b=e.target.closest('[data-act]');if(!b||b.disabled)return;if(!$('modal').hidden&&!b.closest('#modal'))return;if(!tapOk(e,b))return;audioInit();const fn=ACT[b.dataset.act];if(!fn)return;if(!S&&!['start','randomName','pickStart','cont','help','helpClose','newgame','mute','animSet','soundSet','langSet','closeModal','speed','bankClose','whatsNewShow','updateNow','updateLater','importPick','importGo','modeSet','scenarios','startScn','startWeekly','settings','settingsClose','prefSet','vpSet','install','pitchSkip','puzzleMenu','pzStart','pzWeekly'].includes(b.dataset.act))return;let a={};try{a=JSON.parse(b.dataset.args||'{}');}catch(_){}fn(a);});

View file

@ -8,9 +8,9 @@ function frame(now){
if(S&&UI.started&&!S.lost&&now-(UI.lastSave||0)>5000)save();
// The panels catch up on the frame after a day, so one frame does not carry both the day's simulation and them.
if(UI.panelsDue){UI.panelsDue=false;if(!pressing){renderPanel();renderLeft();if(!$('dash').hidden)renderDash();renderBank();}renderHint();}
if(S&&!S.lost&&$('modal').hidden&&UI.speed){acc+=dt*UI.speed;let n=0;while(acc>=DAY_MS&&n<4&&UI.speed){acc-=DAY_MS;try{dayTick();}catch(e){tickErr(e);}n++;}
if(S&&!S.lost&&$('modal').hidden&&UI.speed&&!pzOn()){acc+=dt*UI.speed;let n=0;while(acc>=DAY_MS&&n<4&&UI.speed){acc-=DAY_MS;try{dayTick();}catch(e){tickErr(e);}n++;}
if(n){UI.ticking=true;renderHUD();UI.ticking=false;UI.panelsDue=true;}}
if(UI.speed&&!(S&&S.lost))animT+=dt; /* paused = frozen dots, waves and clouds */
if((UI.speed||pzOn())&&!(S&&S.lost))animT+=dt; /* paused = frozen dots, waves and clouds */
const t=animOn()?animT:0;
if(!(UI.mapHid=mapHidden())&&!mapStill(t,now)){try{draw(t);}catch(e){tickErr(e);}UI.drawnAt=now;}
}

View file

@ -2660,6 +2660,122 @@
"progress.under_attack_now":"Under attack now",
"progress.your_score_peak_traffic":"Your score: peak traffic",
"progress.your_traffic_to_and_from_asia":"Your traffic to and from Asia",
"puzzles.a_backhoe_walks_into_your_network":"A backhoe walks into your network. Nothing happens.",
"puzzles.a_pop_costs_setup_plus_a_year":"A POP costs {setup} to set up, then {mo}/mo. Puzzles count the setup and a year of rent.",
"puzzles.a_tiny_island_where_half_the":"A tiny island where half the Pacific's cables stop for coffee.",
"puzzles.a_to_b_under_ms":"{a} → {b} under {ms} ms",
"puzzles.a_to_b_under_ms_now":"{a} → {b} under {ms} ms (now {now} ms)",
"puzzles.aloha_latency":"Aloha Latency",
"puzzles.avoid_list":"avoid {list}",
"puzzles.back_to_my_network":"Back to my network",
"puzzles.back_to_the_title":"Back to the title screen",
"puzzles.beat_the_clock_light_in_glass":"Light in glass does 200 km per millisecond. Pick your cables like it matters.",
"puzzles.belt_and_braces":"Belt and Braces",
"puzzles.best_x":"best {x}",
"puzzles.budget":"Budget",
"puzzles.budget_x":"budget {x}",
"puzzles.connect_list":"Connect {list}.",
"puzzles.connected":"Connected",
"puzzles.copied_paste_it_anywhere":"Copied! Paste it anywhere:<br>{t}",
"puzzles.de_kicks_sales_has_your_number":"DE-KICKS sales has your number. Connect Germany without Frankfurt.",
"puzzles.diverse_route_40_survives_a_backhoe":"Diverse route (+40%, survives a backhoe)",
"puzzles.down_under_up_and_running":"Down Under, Up and Running",
"puzzles.drag_from_a_pink_pop_to":"Drag from a pink POP to another city to lease a wave",
"puzzles.drag_from_this_pop_onto_another":"Drag from this POP onto another puzzle city, or pick one here.",
"puzzles.euro_trip":"Euro Trip",
"puzzles.every_internet_starts_with_one_tube":"Every internet starts with one tube.",
"puzzles.every_link_n_g_or_more":"Every link {n}G or more",
"puzzles.fat_pipes_only":"Fat Pipes Only",
"puzzles.flash_boys":"Flash Boys",
"puzzles.for_architects_who_sleep_through_backhoes":"For architects who sleep through backhoe season.",
"puzzles.four_capitals_one_very_long_winter":"Four capitals, one very long winter, zero excuses for downtime.",
"puzzles.four_cities_four_cables_one_ring":"Four cities, one ring. Tolkien would approve; your NOC definitely does.",
"puzzles.four_cities_one_continent_and_a":"Four cities, one continent and a lot of corn between them.",
"puzzles.frankfurt_to_singapore_the_short_way":"Frankfurt to Singapore the short way. The long way is overland, and it shows.",
"puzzles.free":"Free",
"puzzles.goal":"Goal",
"puzzles.goal_city":"Goal city",
"puzzles.guam_slam":"Guam Slam",
"puzzles.hello_world":"Hello, World",
"puzzles.honolulu_the_world_s_most_scenic":"Honolulu: the world's most scenic regeneration site.",
"puzzles.includes_a_new_pop_in_city":"Includes a new POP in {city} ({price} for a year).",
"puzzles.it_works_finance_and_the_backhoe":"It works! Finance and the backhoe would like a word.",
"puzzles.keep_building":"Keep building",
"puzzles.kiwi_fruit_salad":"Kiwi Fruit Salad",
"puzzles.lease_a_wave_to":"Lease a wave to",
"puzzles.more_puzzles":"More puzzles",
"puzzles.n_1_club":"N-1 Club",
"puzzles.n_1_connect_everything_first":"N-1: connect everything first",
"puzzles.n_g_links":"{n}G links",
"puzzles.n_week_streak":{"one":"{n} week in a row","other":"{n} weeks in a row"},
"puzzles.new_zealand_is_far_from_everything":"New Zealand is far from everything. That is the point, and the problem.",
"puzzles.next_pack_unlocks_at_n":"Next pack, {pack}, unlocks at {n}⭐",
"puzzles.next_puzzle":"Next puzzle",
"puzzles.no_budget":"no budget",
"puzzles.no_budget_star_on_the_house":"no budget: ⭐ on the house",
"puzzles.no_cable_lands_in_both_try":"No cable lands in both {a} and {b}. Try a stepping stone in between.",
"puzzles.no_clock_no_bills_nothing_breaks":"No clock, no bills, nothing breaks. Connect the cities, then go for three stars: under budget, and still connected when any one link is cut.",
"puzzles.no_pop_in_list":"No POP in {list}",
"puzzles.no_subsea":"no subsea",
"puzzles.no_subsea_cables":"No subsea cables",
"puzzles.nobody_ever_got_fired_for_buying":"Nobody ever got fired for buying 100G.",
"puzzles.not_this_one_find_a_way_around":"Not this one. Find a way around.",
"puzzles.not_through_frankfurt":"Not Through Frankfurt",
"puzzles.off_limits":"Off limits",
"puzzles.on_the_house":"On the house",
"puzzles.one_backhoe_away_from_a_very":"One backhoe away from a very long night. Add a second path for ⭐⭐⭐.",
"puzzles.one_cut_splits_it":"One cut splits it",
"puzzles.one_cut_splits_it_where":"One cut splits it: {where}",
"puzzles.one_ring_through_every_pop":"One ring through every POP",
"puzzles.one_very_big_island_and_a":"One very big island, and a lot of very empty fiber.",
"puzzles.open_a_pop_cost":"Open a POP · {cost}",
"puzzles.pacific_rim_shot":"Pacific Rim Shot",
"puzzles.ping_pong_to_tokyo":"Ping Pong to Tokyo",
"puzzles.price_per_year":"{price}/yr",
"puzzles.puzzle":"Puzzle",
"puzzles.puzzle_solved":"Puzzle solved",
"puzzles.puzzles":"Puzzles",
"puzzles.remove_this_link":"Remove this link",
"puzzles.remove_this_pop":"Remove this POP",
"puzzles.reset":"Reset",
"puzzles.retry_for_3_stars":"Retry for ⭐⭐⭐",
"puzzles.ring":"ring",
"puzzles.ring_of_fire":"Ring of Fire",
"puzzles.rock_solid_and_gold_plated_the":"Rock solid, and gold plated. The CFO has questions.",
"puzzles.samba_sprint":"Samba Sprint",
"puzzles.same_puzzle_for_everyone_this_week":"Same puzzle for everyone this week",
"puzzles.same_trench_cheaper_one_backhoe_cuts":"Same trench (cheaper, one backhoe cuts both)",
"puzzles.sao_paulo_to_miami_before_the":"São Paulo to Miami before the caipirinha gets warm.",
"puzzles.sea_to_shining_sea":"Sea to Shining Sea",
"puzzles.seattle_to_singapore_with_a_stop":"Seattle to Singapore, with a stop for sushi and dim sum.",
"puzzles.share_line":"Series of Tubes puzzle {what} {stars} {spend} · seriesoftub.es",
"puzzles.size":"Size",
"puzzles.small_calm_network_builds":"Small, calm network builds",
"puzzles.smorgasbord":"Smörgåsbord",
"puzzles.speed_runs":"Speed Runs",
"puzzles.spent_x":"Spent {x}",
"puzzles.spent_x_of_y":"Spent {x} / {y}",
"puzzles.stepping_stone_optional":"Stepping stone (optional)",
"puzzles.suez_you_later":"Suez You Later",
"puzzles.survives_any_single_cut":"Survives any single cut",
"puzzles.tap_a_goal_city_to_open":"Tap a glowing city to open your first POP",
"puzzles.that_city_is_not_part_of":"That city is not part of this puzzle.",
"puzzles.the_pacific_is_big_light_is":"The Pacific is big. Light is fast. Your budget is neither.",
"puzzles.the_pacific_rim_where_every_hop":"The Pacific rim, where every hop is an ocean.",
"puzzles.the_shark_tank":"The Shark Tank",
"puzzles.the_sharks_have_been_biting_again":"The sharks have been biting again. Keep it on dry land.",
"puzzles.the_sharks_say_no":"The sharks say no.",
"puzzles.three_cities_two_currencies_one_very":"Three cities, two currencies, one very short tunnel under the sea.",
"puzzles.traders_paid_millions_to_shave_milliseconds":"Traders paid millions to shave milliseconds off this route. You get to do it for less.",
"puzzles.two_cables_across_the_atlantic_because":"Two cables across the Atlantic, because one is a hope, not a plan.",
"puzzles.under_n_ms":"under {n} ms",
"puzzles.undo":"Undo",
"puzzles.unlocks_at_n_stars":"Unlocks at {n}⭐",
"puzzles.weekly_puzzle":"Weekly puzzle",
"puzzles.weekly_puzzle_key":"Weekly puzzle {key}",
"puzzles.with_the_pop_price":"with the POP: {price}",
"puzzles.your_first_tubes_no_pressure":"Your first tubes. No pressure, no budget.",
"puzzles.your_stars":"Your stars",
"reach_and_subsea.premium_submarine_terminals":"Premium submarine terminals",
"release_notes.and_n_more_change":{"one":"…and {n} more change","other":"…and {n} more changes"},
"release_notes.read_the_full_notes_on_github":"Read the full notes on GitHub",

View file

@ -143,6 +143,7 @@
<div id="panelBody" style="display:flex;flex-direction:column;min-height:0;flex:1"></div>
</aside>
<aside id="pzBox" class="card" hidden aria-label="Puzzle" data-i18n-aria-label="puzzles.puzzle"></aside>
<div id="hint" hidden></div>
<div id="coach" hidden role="status"></div>
<div id="toasts" aria-live="polite"></div>

39
src/styles/70-puzzles.css Normal file
View file

@ -0,0 +1,39 @@
/* Puzzles (#190): one card for the goal, the stars and the budget; on phones a bottom sheet you can shrink. */
body.pz #hud .chip:not(.brand):not(.speed),body.pz #hud .speed button:not(#muteBtn),body.pz #leftToggle,body.pz #left{display:none !important}
#pzBox{position:fixed;top:calc(env(safe-area-inset-top,0px) + 76px);left:max(12px,env(safe-area-inset-left,0px));width:300px;max-height:calc(100% - 96px - env(safe-area-inset-top,0px));overflow:auto;z-index:4;padding:10px 14px 12px;box-sizing:border-box}
#pzBox .pzh{display:flex;align-items:center;gap:8px}#pzBox h3{font-size:19px}
.pzj{margin:4px 0 6px;font-size:12.5px;color:var(--ink2);line-height:1.35}
.pzs{display:flex;gap:6px;margin:6px 0}.pzs span{flex:1;display:flex;flex-direction:column;align-items:center;border:2.5px solid var(--ink);border-radius:11px;padding:3px 0;font-size:20px;filter:grayscale(1);opacity:.45;transition:transform .25s,opacity .25s}
.pzs span small{font:900 10px var(--body);text-transform:uppercase;letter-spacing:.05em}.pzs span.on{filter:none;opacity:1;background:#FFF3C4;transform:scale(1.05)}
.pzck{display:flex;flex-wrap:wrap;gap:5px;margin:6px 0}.pzc{font-weight:900;font-size:12px;border:2px solid var(--ink);border-radius:999px;padding:1px 8px;background:#fff}
.pzc.s1{background:#FFE3F0}.pzc.s2{background:var(--ok);color:#fff}
.pztw{font-size:12.5px;font-weight:800;color:var(--bad);margin:3px 0}.pztw.ok{color:var(--eye)}
.pzbud{margin:6px 0}.pzbud .kv{font-size:12.5px}
.pzn1{font-size:12.5px;font-weight:800;margin:6px 0;padding:4px 8px;border:2px solid var(--line);border-radius:10px;color:var(--ink2)}
.pzn1.on{border-color:var(--ok);background:#DFFBEA;color:var(--ink);animation:pzglow 1.6s ease-in-out infinite}.pzn1.bad{border-color:var(--warn);background:#FFF4D6;color:var(--ink)}
@keyframes pzglow{50%{box-shadow:0 0 0 4px rgba(34,196,122,.25)}}
#pzBox .btns{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px}
#pzBox .grab{display:none}
.pzprog{margin:6px 0 4px}.pzpack{font-size:17px;margin:14px 0 2px}.pzst{font-size:12px;letter-spacing:-1px;white-space:nowrap}
.scn.lock{opacity:.5}
.pzres{position:relative}.pzstars{display:flex;justify-content:center;gap:10px;margin:10px 0 2px}
.pzbig{font-size:46px;filter:grayscale(1);opacity:.3}.pzbig.on{filter:none;opacity:1}
.pzbig.pop{animation:pzpop .5s cubic-bezier(.3,1.6,.5,1) var(--d) both}
@keyframes pzpop{0%{transform:scale(0) rotate(-40deg);opacity:0}100%{transform:scale(1) rotate(0);opacity:1}}
.pzconf{position:absolute;inset:-16px;pointer-events:none;overflow:hidden;z-index:2}
.pzconf i{position:absolute;top:-12px;left:var(--x);width:8px;height:12px;background:var(--c);border:1.5px solid var(--ink);border-radius:2px;animation:pzfall var(--t) ease-in var(--dl) both}
@keyframes pzfall{0%{transform:translateY(0) rotate(0);opacity:1}100%{transform:translateY(420px) rotate(var(--r));opacity:0}}
@media (max-width:760px),(max-height:500px) and (pointer:coarse){
#pzBox{top:auto;left:0;right:0;width:auto;bottom:0;max-height:min(46%,330px);border-radius:20px 20px 0 0;border-bottom:0;box-shadow:0 -3px 0 var(--ink);padding:0 12px calc(10px + env(safe-area-inset-bottom,0px))}
#pzBox .grab{display:block}
#pzBox.mini{max-height:none}#pzBox.mini>:not(.grab):not(.pzh):not(.pzs){display:none}
#pzBox.mini .pzs{margin-top:0}
body.pz.sheet-open #pzBox{display:none}
body.pz #panel{bottom:0 !important}
body.pz #hint{bottom:calc(min(46%,330px) + 8px) !important}
.pzbig{font-size:40px}
}
@media (orientation:landscape) and (max-height:500px) and (pointer:coarse),(orientation:landscape) and (max-width:760px) and (max-height:500px){
#pzBox{left:auto;right:0;width:min(360px,52%);top:calc(env(safe-area-inset-top,0px) + 50px);max-height:none;border-radius:20px 0 0 0;border-right:0}
body.pz #hint{bottom:12px !important;left:30% !important}
}

255
tests/puzzles.test.js Normal file
View file

@ -0,0 +1,255 @@
// Puzzle mode (#190): small builds with stars, no clock, and a main save that is never touched.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
// Reference solutions: [a, b, route ('land' or a cable id), tier (0 = 10G, 1 = 100G)].
// `one` earns the goal star, `three` earns all three. A second land link on the same pair is a diverse route.
const REF = {
hello: { one: [['lon', 'nyc', 'grace']], three: [['lon', 'nyc', 'grace'], ['lon', 'nyc', 'amitie']] },
eurotrip: { one: [['lon', 'ams', 'uly'], ['ams', 'fra', 'land']], three: [['lon', 'ams', 'uly'], ['lon', 'ams', 'concerto'], ['ams', 'fra', 'land'], ['ams', 'fra', 'land']] },
shining: { one: [['nyc', 'chi', 'land'], ['chi', 'dal', 'land'], ['dal', 'sjc', 'land']], three: [['nyc', 'chi', 'land'], ['chi', 'sjc', 'land'], ['sjc', 'dal', 'land'], ['dal', 'nyc', 'land']] },
smorgas: { one: [['osl', 'sto', 'land'], ['sto', 'hel', 'land'], ['osl', 'cph', 'land']], three: [['osl', 'sto', 'land'], ['sto', 'hel', 'land'], ['hel', 'cph', 'land'], ['cph', 'osl', 'land']] },
downunder: { one: [['syd', 'mel', 'land'], ['mel', 'adl', 'land'], ['syd', 'bne', 'land']], three: [['syd', 'mel', 'land'], ['mel', 'adl', 'land'], ['adl', 'bne', 'land'], ['bne', 'syd', 'land']] },
aloha: { one: [['sjc', 'hnl', 'scx'], ['hnl', 'syd', 'hwk']], three: [['sjc', 'hnl', 'scx'], ['sjc', 'hnl', 'aag'], ['hnl', 'syd', 'hwk'], ['hnl', 'syd', 'aloha']] },
rimshot: { one: [['sea', 'tok', 'fast'], ['tok', 'hkg', 'adc'], ['hkg', 'sin', 'sjc2']], three: [['sea', 'tok', 'fast'], ['sea', 'tok', 'ncp'], ['tok', 'hkg', 'adc'], ['tok', 'hkg', 'apg'], ['hkg', 'sin', 'sjc2'], ['hkg', 'sin', 'land']] },
fire: { one: [['tok', 'hkg', 'adc'], ['hkg', 'sin', 'sjc2'], ['sin', 'syd', 'indigo'], ['syd', 'tok', 'guam']], three: [['tok', 'hkg', 'adc'], ['hkg', 'sin', 'sjc2'], ['sin', 'syd', 'indigo'], ['syd', 'tok', 'guam']] },
kiwi: { one: [['akl', 'sea', 'hwk'], ['akl', 'syd', 'tasman']], three: [['akl', 'sea', 'hwk'], ['sea', 'hnl', 'hwk'], ['hnl', 'akl', 'hwk'], ['akl', 'syd', 'tasman'], ['akl', 'syd', 'scx']] },
guam: { one: [['tok', 'gum', 'jga'], ['gum', 'syd', 'guam'], ['tok', 'mnl', 'jup']], three: [['tok', 'mnl', 'jup'], ['mnl', 'gum', 'bifrost'], ['gum', 'syd', 'guam'], ['syd', 'tok', 'guam']] },
flash: { one: [['nyc', 'lon', 'hibx']], three: [['nyc', 'lon', 'hibx'], ['nyc', 'lon', 'grace']] },
pingpong: { one: [['lax', 'tok', 'jup']], three: [['lax', 'tok', 'jup'], ['lax', 'sea', 'land'], ['sea', 'tok', 'fast']] },
suez: { one: [['fra', 'mrs', 'land'], ['mrs', 'sin', 'peace']], three: [['fra', 'mrs', 'land'], ['fra', 'mrs', 'land'], ['mrs', 'sin', 'peace'], ['mrs', 'bom', 'twoaf'], ['bom', 'sin', 'land']] },
samba: { one: [['sao', 'mia', 'monet']], three: [['sao', 'mia', 'monet'], ['sao', 'for', 'land'], ['for', 'mia', 'monet']] },
sharks: { one: [['lis', 'mad', 'land'], ['mad', 'par', 'land'], ['par', 'mil', 'land']], three: [['lis', 'mad', 'land'], ['mad', 'par', 'land'], ['par', 'mil', 'land'], ['mil', 'lis', 'land']] },
braces: { one: [['nyc', 'lon', 'grace'], ['lon', 'dub', 'celtix']], three: [['nyc', 'lon', 'grace'], ['lon', 'dub', 'celtix'], ['dub', 'nyc', 'havf']] },
nofra: { one: [['ams', 'ber', 'land'], ['ber', 'muc', 'land'], ['muc', 'zrh', 'land']], three: [['ams', 'ber', 'land'], ['ber', 'muc', 'land'], ['muc', 'zrh', 'land'], ['zrh', 'ams', 'land']] },
fatpipes: { one: [['par', 'mrs', 'land', 1], ['mrs', 'mil', 'land', 1], ['mil', 'zrh', 'land', 1]], three: [['par', 'mrs', 'land', 1], ['mrs', 'mil', 'land', 1], ['mil', 'zrh', 'land', 1], ['zrh', 'par', 'land', 1]] },
};
// Builds links the way a player does: POP at the first city, then the link picker for each hop.
function build(ev, links) {
for (const [a, b, via, tier] of links) {
if (!ev(`!!S.pops['${a}']`)) ev(`ACT.pzPop({city:'${a}'})`);
ev(`ACT.pzLinkTo({a:'${a}',b:'${b}'});ACT.pzVia({v:'${via}'});ACT.pzDiv({v:1});ACT.pzLink({tier:${tier || 0}})`);
}
ev('closeModal()');
}
const evalP = (ev) => JSON.parse(ev('JSON.stringify(pzEval())'));
test('puzzle data: every puzzle is valid, solvable, and its 3-star reference earns three stars', () => {
const { ev, errors } = load();
const ids = JSON.parse(ev('JSON.stringify(PZ.map(p=>p.id))'));
assert.ok(ids.length >= 16, 'at least 16 puzzles');
assert.equal(new Set(ids).size, ids.length, 'ids are unique');
assert.deepEqual(Object.keys(REF).sort(), ids.slice().sort(), 'every puzzle has a reference solution');
assert.ok(ev("PZ.every(p=>PZ_PACKS.some(k=>k.id===p.pack)&&p.n&&p.j&&p.cities.length>=2&&p.cities.length<=6&&[...p.cities,...(p.via||[]),...(p.avoid||[])].every(c=>isCity(c)&&!CITY[c].off&&!CITY[c].cn))"), 'cities exist and are playable');
assert.ok(ev("PZ.every(p=>!p.budget||(p.budget>=100000&&p.budget<=5e6))"), 'budgets are sane');
assert.ok(ev("PZ_PACKS[0].need===0&&PZ_PACKS.every((k,i)=>!i||k.need>PZ_PACKS[i-1].need)"), 'packs unlock in order');
assert.ok(ev("PZ.filter(p=>p.pack==='hello'&&!p.budget).length>=2"), 'the first puzzles give the budget star away');
for (const id of ids) {
ev(`pzBegin(pzDef('${id}'))`);
build(ev, REF[id].one);
let e = evalP(ev);
assert.ok(e.goal, `${id}: the one-star reference reaches the goal`);
assert.ok(e.stars >= 1, `${id}: one star`);
ev('ACT.pzReset({})');
assert.equal(evalP(ev).stars, 0, `${id}: reset clears it`);
build(ev, REF[id].three);
e = evalP(ev);
assert.equal(e.stars, 3, `${id}: three stars (spend ${e.spend} of ${ev('S.pz.budget')}, n1 ${e.n1}, twists ${JSON.stringify(e.tw)})`);
}
assert.deepEqual(errors, []);
});
test('stars: goal, budget, N-1 and twists each count', () => {
const { ev, errors } = load();
ev("pzBegin(pzDef('braces'))");
build(ev, REF.braces.one);
let e = evalP(ev);
assert.equal(e.stars, 2, 'connected and under budget, but one cut splits it');
assert.ok(!e.n1 && e.weak.length > 0);
build(ev, [['dub', 'nyc', 'havf']]);
assert.equal(evalP(ev).stars, 3);
ev('S.pz.budget=1000');
assert.equal(evalP(ev).stars, 2, 'over budget loses the second star');
// Two waves in the same trench are one backhoe away from nothing.
ev("pzBegin(pzDef('shining'))");
build(ev, REF.shining.one);
ev("ACT.pzLinkTo({a:'nyc',b:'chi'});ACT.pzVia({v:'land'});ACT.pzDiv({v:0});ACT.pzLink({tier:0})");
assert.equal(ev("new Set(S.links.filter(l=>edgeKey(l)==='chi|nyc').map(pzUnit)).size"), 1, 'same trench shares the cut');
// Twists: no subsea, ring, latency, minimum size, cities to avoid.
ev("pzBegin(pzDef('sharks'))");build(ev, REF.sharks.one);
assert.ok(evalP(ev).goal);
ev("pzBegin(pzDef('fire'))");build(ev, REF.fire.one);ev("ACT.pzRmLink({id:S.links[3].id})");
e = evalP(ev);
assert.ok(e.conn && !e.goal, 'a line is not a ring');
ev('ACT.pzUndo({})');
assert.ok(evalP(ev).goal, 'undo puts the ring back');
ev("pzBegin(pzDef('flash'))");build(ev, [['nyc', 'lon', 'grace']]);
e = evalP(ev);
assert.ok(e.conn && !e.goal, 'Grace Hopscotch is too slow for the traders');
ev("pzBegin(pzDef('fatpipes'))");build(ev, REF.fatpipes.one.map(([a, b, v]) => [a, b, v, 0]));
assert.ok(!evalP(ev).goal, '10G is too thin');
ev("ACT.pzTier({id:S.links[0].id,tier:1});ACT.pzTier({id:S.links[1].id,tier:1});ACT.pzTier({id:S.links[2].id,tier:1})");
assert.ok(evalP(ev).goal, 'upgraded in place');
ev("pzBegin(pzDef('nofra'))");
ev("ACT.pzPop({city:'fra'})");
assert.equal(ev("!!S.pops.fra"), false, 'no POP in a city to avoid');
assert.equal(ev("pzKind('lon')"), null, 'cities outside the puzzle are inert');
ev("ACT.pzPop({city:'lon'})");
assert.equal(ev("Object.keys(S.pops).length"), 0);
// Subsea is greyed out in the shark tank.
ev("pzBegin(pzDef('sharks'));ACT.pzPop({city:'lis'});ACT.pzLinkTo({a:'lis',b:'bcn'});ACT.pzVia({v:'medusa'});ACT.pzLink({tier:0})");
assert.equal(ev('S.links.length'), 0);
assert.deepEqual(errors, []);
});
test('no clock in a puzzle: days never pass, nothing breaks, no bills', () => {
const { ev, errors } = load();
ev("pzBegin(pzDef('hello'))");
build(ev, REF.hello.three);
ev('ACT.speed({v:8});ACT.phonePlay({});for(let i=0;i<50;i++)frame(performance.now()+i*3000)');
assert.equal(ev('S.day'), 0);
assert.equal(ev('UI.speed'), 0);
assert.equal(ev('S.inc.length'), 0);
assert.equal(ev('S.cash'), ev('START_CASH'), 'nothing is charged');
assert.equal(ev("document.getElementById('left').hidden"), true, 'no goals/deals/NOC/networks drawer');
assert.equal(ev("document.getElementById('pzBox').hidden"), false);
assert.deepEqual(errors, []);
});
test('the main save is byte-identical before and after playing and solving a puzzle', () => {
const { ev, errors } = load();
ev("ACT.start({});S.cash=1e7;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'});ACT.buildPop({city:'ams'});save(true)");
const before = ev("localStorage.getItem('sot-save-v1')");
const name = ev('S.name'), day = ev('S.day');
ev('ACT.puzzleMenu({})');
assert.match(ev("document.getElementById('modalCard').textContent"), /Hello, World/);
ev("ACT.pzStart({id:'hello'})");
assert.equal(ev('S.mode'), 'puzzle');
build(ev, REF.hello.three);
ev("save(true);for(let i=0;i<5;i++)frame(performance.now()+6000*i);window.dispatchEvent(new Event('pagehide'));ACT.exportSave({})");
assert.equal(ev("localStorage.getItem('sot-save-v1')"), before, 'untouched while in the puzzle');
assert.equal(ev("JSON.parse(localStorage.getItem('sot-puzzles')).s.hello.st"), 3, 'the stars are kept');
ev('ACT.pzLeave({})');
assert.equal(ev('S.mode'), 'normal');
assert.equal(ev('S.name'), name);
assert.equal(ev('S.day'), day);
assert.ok(ev('!!S.pops.ams'));
assert.equal(ev('UI.started'), true);
assert.equal(ev("localStorage.getItem('sot-save-v1')"), before, 'and after');
assert.deepEqual(errors, []);
});
test('leaving a puzzle with no game goes back to the title screen', () => {
const { ev, errors } = load();
assert.ok(ev("!!document.querySelector('#modalCard [data-act=puzzleMenu]')"), 'the title screen has a way in');
ev("document.querySelector('#modalCard [data-act=puzzleMenu]').click()");
ev("document.querySelector('#modalCard [data-act=pzStart]').click()");
assert.equal(ev('S.mode'), 'puzzle');
ev('ACT.pzLeave({})');
assert.equal(ev('S'), null);
assert.equal(ev("localStorage.getItem('sot-save-v1')"), null, 'no main save appeared');
assert.match(ev("document.getElementById('modalCard').textContent"), /Series/);
assert.deepEqual(errors, []);
});
test('results card pops the stars, offers the next puzzle, a retry and a share line', () => {
const { ev, errors } = load();
ev("pzBegin(pzDef('eurotrip'))");
build(ev, REF.eurotrip.one);
let card = ev("document.getElementById('modalCard').textContent");
assert.match(card, /Puzzle solved/);
assert.ok(ev("!!document.querySelector('#modalCard [data-act=pzRetry]')"));
assert.match(ev("document.querySelector('#modalCard [data-act=pzStart]').dataset.args"), /shining/);
build(ev, [['lon', 'ams', 'concerto'], ['ams', 'fra', 'land']]);
card = ev("document.getElementById('modalCard').textContent");
assert.match(card, /A backhoe walks into your network/);
assert.equal(ev("document.querySelectorAll('#modalCard .pzbig.on').length"), 3);
const line = ev('pzShareText(pzEval())');
assert.match(line, /^Series of Tubes puzzle Euro Trip ⭐⭐⭐ \$\d+k · seriesoftub\.es$/);
assert.deepEqual(errors, []);
});
test('weekly puzzle: stable seed per ISO week, solvable, share string and streak', () => {
const { ev, errors } = load();
const a = ev("JSON.stringify(pzWeekly(new Date(2026,9,28)))"), b = ev("JSON.stringify(pzWeekly(new Date(2026,10,1)))"), c = ev("JSON.stringify(pzWeekly(new Date(2026,10,2)))");
assert.equal(a, b, 'same week, same puzzle');
assert.notEqual(a, c, 'next week, a new one');
const w = JSON.parse(a);
assert.equal(w.key, '2026-W44');
assert.ok(w.cities.length >= 4 && w.cities.length <= 5 && w.budget > 0);
// Every week of a few years can be solved with three stars by its own reference ring.
for (let i = 0; i < 160; i += 7) {
ev(`pzBegin(pzWeekly(new Date(2026,0,1+${i})))`);
const ring = JSON.parse(ev('JSON.stringify(pzWeekly(new Date(2026,0,1+' + i + ')).ref)'));
const links = ring.map((x, j) => { const y = ring[(j + 1) % ring.length]; return [x, y, ev(`pzRoutes('${x}','${y}').sort((p,q)=>pzLinkCost(p,0)-pzLinkCost(q,0))[0].via`)]; });
build(ev, links);
assert.equal(evalP(ev).stars, 3, `week +${i}`);
}
ev("localStorage.removeItem('sot-puzzles');pzBegin(pzWeekly(new Date(2026,9,28)))");
const ring = w.ref;
build(ev, ring.map((x, j) => { const y = ring[(j + 1) % ring.length]; return [x, y, ev(`pzRoutes('${x}','${y}').sort((p,q)=>pzLinkCost(p,0)-pzLinkCost(q,0))[0].via`)]; }));
assert.match(ev('pzShareText(pzEval())'), /^Series of Tubes puzzle 2026-W44 ⭐⭐⭐ \$\d+k · seriesoftub\.es$/);
assert.equal(ev("JSON.parse(localStorage.getItem('sot-puzzles')).streak.n"), 1);
// A streak counts weeks in a row; a gap starts again.
ev("const p=pzLoad();pzStreak(p,'2026-W45');pzStreak(p,'2026-W45');pzStreak(p,'2026-W46');window.__p=p");
assert.equal(ev('__p.streak.n'), 3);
ev("pzStreak(__p,'2026-W49')");
assert.equal(ev('__p.streak.n'), 1);
assert.equal(ev('__p.streak.best'), 3);
assert.equal(ev("pzPrevKey('2027-W01')"), '2026-W53');
assert.equal(ev("pzPrevKey('2026-W01')"), '2025-W52');
assert.deepEqual(errors, []);
});
test('pack unlocking follows the stars, and bad progress data is ignored', () => {
const { ev, errors } = load();
ev("localStorage.removeItem('sot-puzzles')");
assert.equal(ev("pzPackOpen('hello')"), true);
assert.equal(ev("pzPackOpen('fire')"), false);
ev("ACT.pzStart({id:'aloha'})");
assert.notEqual(ev('S&&S.mode'), 'puzzle', 'a locked puzzle does not start');
ev("localStorage.setItem('sot-puzzles',JSON.stringify({s:{hello:{st:3},eurotrip:{st:3}}}))");
assert.equal(ev("pzPackOpen('fire')"), true, '6 stars open pack 2');
ev('ACT.puzzleMenu({})');
assert.match(ev("document.getElementById('modalCard').textContent"), /Next pack, Speed Runs, unlocks at 14/);
ev("localStorage.setItem('sot-puzzles',JSON.stringify({s:{hello:{st:99,sp:'x'},nope:{st:3},__proto__:{st:3}},wk:{bad:{st:3}},streak:{n:-4,last:'<b>'}}))");
const p = JSON.parse(ev('JSON.stringify(pzLoad())'));
assert.deepEqual(p.s, { hello: { st: 3, sp: null } });
assert.deepEqual(p.wk, {});
assert.deepEqual(p.streak, { last: null, n: 0, best: 0 });
ev("localStorage.setItem('sot-puzzles','{nope')");
assert.equal(ev('pzStarsTotal(pzLoad())'), 0);
assert.deepEqual(errors, []);
});
test('puzzle HUD fits a 360 px phone: bottom sheet, no tab bar, panels work', () => {
const { dom, ev, errors } = load();
ev("innerWidth=360;innerHeight=740;dispatchEvent(new Event('resize'))");
ev("pzBegin(pzDef('hello'))");
assert.equal(ev("document.getElementById('tabbar').hidden"), true);
assert.equal(ev("document.getElementById('pzBox').hidden"), false);
ev("selectCity('lon')");
assert.match(ev("document.getElementById('panelBody').textContent"), /Open a POP/);
ev("document.querySelector('#panelBody [data-act=pzPop]').click()");
assert.ok(ev('!!S.pops.lon'));
ev("selectCity('par')");
assert.equal(ev("document.getElementById('panel').hidden"), true, 'other cities do nothing');
ev("pzLinkModal('lon','nyc')");
assert.ok(ev("document.querySelectorAll('#modalCard .tierbtn').length") === 3, 'three sizes');
assert.deepEqual(errors, []);
void dom;
});
test('puzzles in every language', () => {
for (const lang of ['de', 'es', 'fr', 'it', 'pt']) {
const { ev, errors } = load({ lang });
ev("ACT.puzzleMenu({});pzBegin(pzDef('braces'))");
build(ev, REF.braces.three);
const seen = ev("['pzBox','modalCard','hud'].map(id=>document.getElementById(id).textContent).join(' ')");
assert.ok(!/puzzles\./.test(seen), `${lang}: no raw labels`);
assert.match(seen, /⭐/);
assert.deepEqual(errors, [], lang);
}
});