diff --git a/CHANGELOG.md b/CHANGELOG.md index bee37c8..f84f9af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project are documented here. The project follows - A new start screen with four doors: Puzzles, Sandbox, Normal, and Scenarios & weekly. Every network now picks its rules when it starts, and they stay locked for that network; your saved games carry on exactly as before. - Normal comes in three flavours. Change Freeze has a third of the outages and no DDoS floods, delivers PNIs, cross-connects and builds in days instead of months (#151), and skips the peering inbox, hardware shortages and sold-out routes. On-call is the classic game. BGP at 3 a.m. brings almost twice the outages, lasting half as long again, and twice the DDoS. The HUD and the share card show which one you picked. - Sandbox is a real sandbox now (#188): everything is unlocked from day one, your own subsea cable included, money never runs out, deliveries are quick, and you pick how much chaos you want, from none to spicy. +- Puzzles: small, calm network builds you can finish in a coffee break (#190). Connect a few cities on the real map with POPs and leased waves, with no clock, no bills and nothing breaking, and earn up to three stars: one for the goal, one for staying under budget, and one if the network survives any single cut. Eighteen puzzles in four packs (more stars open the next pack), some with a twist like a latency target, no subsea cables or a ring, plus a weekly puzzle that is the same for everyone, with a streak and a result to share. Puzzles never touch your saved network; only your stars are kept. - China Telecomet now sells its CN-Too premium crossing in Moscow too, at the same price as in Hong Kong (#195). Haul your European traffic to Moscow and it reaches China with about 3% loss; nothing else of theirs is on offer there. - Series of Tubes now speaks German. The game follows your browser's language the first time, and you can switch to German under Settings or on the title screen. Networking terms like Peering and Transit stay in English, the way network engineers say them. - Glowball Sakura Lager joins the map: a Tier 2 carrier in the big hubs of the US, Europe and Asia-Pacific that sells transit, takes PNIs and peers openly wherever it is. It is not a Tier 1, so it buys its own transit from three of them, while 13 smaller networks in its regions buy theirs from it, and one PNI with it reaches about 3% of all traffic. Far from home, in Asia and New Zealand, it charges more than the locals, and it sells no transit in Australia. diff --git a/site/i18n/de.js b/site/i18n/de.js index 9c859db..50528d2 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -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:
{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", diff --git a/site/i18n/es.js b/site/i18n/es.js index d81e36e..323fe9a 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -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:
{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", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index c1ceb68..51ff0dc 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -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 :
{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", diff --git a/site/i18n/it.js b/site/i18n/it.js index e47f8c2..811630e 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -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:
{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", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index eeccb26..1ba71b7 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -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:
{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", diff --git a/src/game/60-features/90-puzzles-data.js b/src/game/60-features/90-puzzles-data.js new file mode 100644 index 0000000..1d7ede6 --- /dev/null +++ b/src/game/60-features/90-puzzles-data.js @@ -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'], +]; diff --git a/src/game/60-features/92-puzzles.js b/src/game/60-features/92-puzzles.js new file mode 100644 index 0000000..b0ca38e --- /dev/null +++ b/src/game/60-features/92-puzzles.js @@ -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.lengthkmBetween(u,a)-kmBetween(u,b));ring.push(left.shift());} + let cost=cities.reduce((a,c)=>a+pzPopCost(c),0);for(let i=0;ipzLinkCost(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.rules=makeRules('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(`${esc(pzName(def))}
${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 beside the puzzle card: left on wide screens, right on phones on their side, 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(),side=ph&&CW>CH,pl=side?-Math.min(360,CW*0.52):ph?0:330,pb=ph&&!side?Math.min(230,CH*0.4):0,aw=Math.max(120,CW-Math.abs(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{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); diff --git a/src/game/90-actions/10-interface.js b/src/game/90-actions/10-interface.js index b565c89..679724d 100644 --- a/src/game/90-actions/10-interface.js +++ b/src/game/90-actions/10-interface.js @@ -1,13 +1,13 @@ /* ================= ACTIONS ================= */ function spend(c){if(S.cash{v=+v;if(![0,0.5,1,2,4,8].includes(v)||(S&&!rule('clock')&&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)||(S&&!rule('clock')&&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:()=>{if(S&&!rule('clock'))return;haptic(10);if(UI.speed){UI.lastSpeed=UI.speed;UI.speed=0;}else UI.speed=UI.lastSpeed||1;renderHUD();}, - phoneSpeed:()=>{if(S&&!rule('clock'))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();}, + phonePlay:()=>{if(pzOn())return;if(S&&!rule('clock'))return;haptic(10);if(UI.speed){UI.lastSpeed=UI.speed;UI.speed=0;}else UI.speed=UI.lastSpeed||1;renderHUD();}, + phoneSpeed:()=>{if(pzOn())return;if(S&&!rule('clock'))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();}, diff --git a/src/game/90-actions/89-game-and-settings.js b/src/game/90-actions/89-game-and-settings.js index 622d022..29e3baf 100644 --- a/src/game/90-actions/89-game-and-settings.js +++ b/src/game/90-actions/89-game-and-settings.js @@ -19,7 +19,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(`
AS${S.asn} · ${esc(dateStr(S.day))} · ${tierLabel()}

${esc(S.name)}

+ menu:()=>{if(!S||!UI.started){showTitle();return;}if(pzOn()){pzMenu();return;}openModal(`
AS${S.asn} · ${esc(dateStr(S.day))} · ${tierLabel()}

${esc(S.name)}

${saveFailing()?`

${saveFailMsg()}

`:`

${tr('game_and_settings.your_game_saves_itself_every_few')}

`}${isPhone()?installRow():''} ';} + 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)}`,`${capName(l)}${l.km.toLocaleString()} km${linkLat(l).toFixed(1)} ms${tr('puzzles.price_per_year',{price:fmt$(l.mo*PZ_YEAR)})}`)+'
'; + h+=`

${tr('puzzles.size')}

${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} ${tr('puzzles.price_per_year',{price:fmt$(pzMo(r,i,false)*PZ_YEAR)})}`,'pzTier',{id:l.id,tier:i},l.tier===i?'pink':'ghost',!!why||l.tier===i);}).join('')}
`; + return h+`
${btn(tr('puzzles.remove_this_link'),'pzRmLink',{id:l.id},'red sm')}
`;} +// 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=`
${kmBetween(a,b).toLocaleString()} km

${esc(CITY[a].name)} → ${esc(CITY[b].name)}

`; + if(!rs.length){openModal(head+`

${tr('puzzles.no_cable_lands_in_both_try',{a:esc(CITY[a].name),b:esc(CITY[b].name)})}

`);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+`

${tr('common.route')}

${rs.map(x=>btn(`${x.cab?esc(CAB[x.cab].name):tr('common.overland')} ${x.ms.toFixed(1)} ms${x.cab&&CAB[x.cab].age==='old'?'':''}`,'pzVia',{v:x.via},x.via===r.via?'pink':'ghost',P.noSub&&x.sub)).join('')}
`; + if(P.noSub&&r.sub)h+=`

${tr('puzzles.the_sharks_say_no')}

`; + if(r.cab)h+=`

${esc(CAB[r.cab].blurb)}

`; + if(land)h+=`
${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')}
`; + if(pop)h+=`

${tr('puzzles.includes_a_new_pop_in_city',{city:esc(CITY[b].name),price:fmt$(pop)})}

`; + h+=`
${PZ_TIERS.map(i=>{const why=subWaveWhy(i,r.km,r.sub),c=pzLinkCost(r,i,div)+pop;return ``;}).join('')}
`; + 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+=``; + return ``;} +function pzResults(e,prev){const P=S.pz,nx=P.id==='weekly'?null:pzNextDef(); + const row=(ok,l,v)=>`
${ok?'⭐':'☆'} ${l}${v}
`; + const stars=[0,1,2].map(i=>`⭐`).join(''); + openModal(`
${e.stars>=3?pzConfetti():''}
${tr('puzzles.puzzle_solved')}

${esc(pzName(pzDef(P.id)||P))}

+
${stars}

${pzLine(e)}

+ ${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'))} +
${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')}
`); + for(let i=prev;i{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=`
${tr('puzzles.puzzles')}

${tr('puzzles.small_calm_network_builds')}

+

${tr('puzzles.no_clock_no_bills_nothing_breaks')}

+
${tr('puzzles.your_stars')}⭐ ${tot} / ${max}
${nxP?`
${tr('puzzles.next_pack_unlocks_at_n',{n:nxP.need,pack:esc(nxP.n)})}
`:''}
`; + if(pzOn())h+=`
${btn(UI.pzFrom==='game'?tr('puzzles.back_to_my_network'):tr('puzzles.back_to_the_title'),'pzLeave',{},'')}${btn(tr('puzzles.keep_building'),'closeModal',{},'ghost')}
`; + h+=`
${tr('puzzles.weekly_puzzle_key',{key:esc(w.key)})} ${wr?`${pzStarStr(wr.st)}`:''}
${w.cities.map(c=>esc(CITY[c].name)).join(' · ')} · ${tr('puzzles.budget_x',{x:fmt$(w.budget)})}
${tr('puzzles.same_puzzle_for_everyone_this_week')}${streak?' · 🔥 '+trn('puzzles.n_week_streak',streak):''}
${btn(tr('common.play'),'pzWeekly',{},'pink')}
`; + for(const pk of PZ_PACKS){const open=tot>=pk.need,got=PZ.filter(x=>x.pack===pk.id).reduce((a,x)=>a+((p.s[x.id]||{}).st|0),0),n=PZ.filter(x=>x.pack===pk.id).length; + h+=`

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

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

`; + for(const d of PZ.filter(x=>x.pack===pk.id)){const r=p.s[d.id],tg=pzTwistTag(d); + h+=`
${esc(d.n)} ${pzStarStr(r?r.st:0)}
${esc(d.j)}
${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?' · '+tg.join(' · ')+'':''}${r&&r.sp!=null?' · '+tr('puzzles.best_x',{x:fmt$(r.sp)}):''}
${btn(tr('common.play'),'pzStart',{id:d.id},r&&r.st>=3?'ghost':'',!open)}
`;}} + openModal(h);} diff --git a/src/game/96-map/60-draw.js b/src/game/96-map/60-draw.js index fe22967..de49bd3 100644 --- a/src/game/96-map/60-draw.js +++ b/src/game/96-map/60-draw.js @@ -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;}} diff --git a/src/game/96-map/85-puzzle-cities.js b/src/game/96-map/85-puzzle-cities.js new file mode 100644 index 0000000..3c2a0f0 --- /dev/null +++ b/src/game/96-map/85-puzzle-cities.js @@ -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);} diff --git a/src/game/96-map/90-input.js b/src/game/96-map/90-input.js index 6ca8d0c..05806df 100644 --- a/src/game/96-map/90-input.js +++ b/src/game/96-map/90-input.js @@ -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{ 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'&&(!S||rule('clock'))){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'&&(!S||rule('clock'))&&!pzOn()){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();}}}); diff --git a/src/game/96-map/95-clicks.js b/src/game/96-map/95-clicks.js index 34711e3..5b68bee 100644 --- a/src/game/96-map/95-clicks.js +++ b/src/game/96-map/95-clicks.js @@ -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','presetSet','chaosSet','puzzleDoor','puzzleMenu','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','presetSet','chaosSet','puzzleDoor','puzzleMenu','pzStart','pzWeekly','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);}); diff --git a/src/game/99-loop.js b/src/game/99-loop.js index 7f1b386..84ea6d9 100644 --- a/src/game/99-loop.js +++ b/src/game/99-loop.js @@ -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;} } diff --git a/src/i18n/en.js b/src/i18n/en.js index 8acccb3..c023596 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -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:
{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", diff --git a/src/index.html b/src/index.html index 2f8bfa9..4b97816 100644 --- a/src/index.html +++ b/src/index.html @@ -143,6 +143,7 @@
+
diff --git a/src/styles/70-puzzles.css b/src/styles/70-puzzles.css new file mode 100644 index 0000000..20fa6b1 --- /dev/null +++ b/src/styles/70-puzzles.css @@ -0,0 +1,40 @@ +/* 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} + body.pz #toasts{left:8px !important;transform:none !important;width:calc(48% - 16px) !important} +} diff --git a/tests/puzzles.test.js b/tests/puzzles.test.js new file mode 100644 index 0000000..b7c4d6e --- /dev/null +++ b/tests/puzzles.test.js @@ -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 .door[data-door=puzzle]')"), 'the title screen has a Puzzles door'); + ev("document.querySelector('#modalCard .door[data-door=puzzle]').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:''}}))"); + 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); + } +}); diff --git a/tests/rules.test.js b/tests/rules.test.js index aab6864..9d24992 100644 --- a/tests/rules.test.js +++ b/tests/rules.test.js @@ -60,8 +60,6 @@ test('the title screen: four doors, three Normal presets, a chaos picker for San assert.equal(doc.getElementById('doorSandbox').hidden, false); assert.equal(doc.getElementById('doorNormal').hidden, true); doc.querySelector('.chs[data-chaos=spicy]').click(); - doc.querySelector('.door[data-door=puzzle]').click(); - assert.match(doc.getElementById('toasts').textContent, /coming soon/, 'puzzles are not here yet'); doc.querySelector('.door[data-door=normal]').click(); ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip()"); assert.equal(ev('rulePreset()'), 'freeze');