Add Best Effort, a soft mode, and quiet notifications

A fourth Normal preset, gentler than Change Freeze: calm chaos (so no DDoS
and no chaos monkey), quick builds and no market, plus four new rules that
only it softens: sea cuts mend on their own clock without cable ships, no
conference season, a five-year Ministry of Tubes rescue loan instead of
game over, and customers who sour half as fast. The new rules are written
into S.rules only when they differ from the classic game, so older networks'
rules stay byte for byte what they were.

Quiet notifications is a new setting for every mode, on by default in Best
Effort: toasts the day itself raises pop up only for trouble and milestones,
the rest goes to the NOC log; what a click says still shows. Best Effort
badges count as Freeze-dried. The preset picker is four wide, two by two on
a phone in portrait.
This commit is contained in:
Frederic Jung 2026-11-03 08:12:09 +00:00
parent de4a750cdd
commit 09f205e458
No known key found for this signature in database
21 changed files with 228 additions and 28 deletions

View file

@ -43,8 +43,8 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one
| Id | Rule | Why |
| --- | --- | --- |
| M1 | On-call is the classic game: it equals `RULE_DEF`, and a save without rules loads as On-call. The seeded suites (`tests/game.test.js`, `tests/rules.test.js`) are its behaviour. | Old saves never change under them. |
| M2 | Presets are ordered: Change Freeze never harsher than On-call, BGP at 3 a.m. never gentler (chaos, lead times, market; and a seeded year of incidents). | The names promise it. |
| M3 | Every subsystem that can annoy the player reads a rule: outages and events (`chaos`), DDoS, sold-out routes, de-peering and hardware prices (`market`), lead times (`lead`), the clock. A quiet ruleset gives a quiet year. | Rules are presets of flags, not separate code. |
| M2 | Presets are ordered: Best Effort never harsher than Change Freeze, Change Freeze never harsher than On-call, BGP at 3 a.m. never gentler (chaos, lead times, market; and a seeded year of incidents). Only Best Effort mends sea cuts without ships, skips conferences, rescues instead of game over and has patient customers. | The names promise it. |
| M3 | Every subsystem that can annoy the player reads a rule: outages and events (`chaos`), DDoS, sold-out routes, de-peering and hardware prices (`market`), lead times (`lead`), the clock, cable ships (`sea`), conferences (`confs`), going broke (`broke`), customer patience (`moods`), and the day's toasts (quiet notifications). A quiet ruleset gives a quiet year. | Rules are presets of flags, not separate code. |
| M4 | Scenarios and the weekly challenge always run On-call plus their own `S.scn.rules`. | Fair scores. |
| M5 | Sandbox has no locked feature: open gates, every level, own cables, endless money. | It is a sandbox. |

View file

@ -8,6 +8,7 @@ All notable changes to this project are documented here. The project follows
- Networks you reach through an exchange's route server now stay "via RS" (#265). With an Open peering policy, the peering desk used to turn some of them into separate sessions of their own.
- The intern's "Light more fiber" order has a new Optics setting: light new fiber with the biggest optic it can afford, to save channels for later (#262). Once a fiber is lit, the intern still adds more of the same optic and never swaps what is in there.
- New Best Effort mode, the gentlest way to play: rare outages, no DDoS, no chaos monkey, no conferences and no cable ships, with sea cuts that mend on their own. Customers are more patient, a rescue loan from the Ministry of Tubes replaces game over, builds take days and prices never spike. A new Quiet notifications setting, on by default in Best Effort and available in every mode, only pops up trouble and milestones; everything else goes into the NOC log.
- The Build POP button now shows the whole price of a new POP, including the routers of your standard POP (#261). Before, it showed only the site, although the standard routers were paid for on top; a note under the button now lists them, and the intern's one-tap template prices them in as well. POPs that come with a new wave, dark fiber, your own subsea cable or a consortium seat now get the standard routers too, and those offers show the price with them.
## [2.5.0] — 2026-11-02

View file

@ -284,11 +284,13 @@
"bank.the_rest_is_due_at_the":"der Rest ist am Ende fällig",
"bank.then_about_price_at_once":"dann etwa {price} auf einmal",
"bank.you_pay_pct_of_your_transit":"Du zahlst {pct} deiner Transit-Rechnung, bis {price} zurückgezahlt sind.",
"banks.a_rescue_loan_of_amount_keeps":"Ein Rettungskredit über {amount} hält das Licht an: {pay} im Monat für fünf Jahre, ohne Bedingungen.",
"banks.always_open_ask_no_questions_do":"Immer geöffnet. Stellt keine Fragen. Komm nicht zu spät.",
"banks.always_run_an_odd_number_of":"Betreibe immer eine ungerade Anzahl POPs. Unser Numerologe besteht darauf.",
"banks.bank_are_circling_they_now_take":"<b>{bank} kreisen über dir.</b><br>Sie nehmen jetzt {pct} deines Umsatzes.",
"banks.bank_is_unhappy_you_broke_a":"<b>{bank} ist unzufrieden.</b><br>Du hast eine Kreditbedingung verletzt: {cond} Behebe das innerhalb von 10 Tagen, sonst zahlst du eine Vertragsstrafe.",
"banks.bank_sign_is_in_retrograde_your":"<b>{bank}: {sign} ist rückläufig.</b><br>Dein Zinssatz liegt jetzt bei {apr} %.",
"banks.bank_stepped_in":"{bank} ist eingesprungen.",
"banks.bank_the_balloon_popped_the":"<b>{bank}: Der Ballon ist geplatzt.</b><br>Die restlichen {price} waren heute fällig, alles auf einmal. Sie haben dein Konto verlassen.",
"banks.bank_would_like_to_lend_you":"<b>{bank} würde dir gern {amount} leihen.</b>",
"banks.cheap_patient_and_very_particular":"Günstig, geduldig und sehr eigen, was Stuttgart angeht.",
@ -3535,6 +3537,7 @@
"rules.a_billion_dollars_every_unlock_your":"Eine Milliarde Dollar, alles freigeschaltet, dein eigenes Seekabel.",
"rules.a_cut_now_and_then":"Ab und zu ein Bagger.",
"rules.a_third_of_the_outages_no_ddos_pnis":"Ein Drittel der Ausfälle, kein DDoS. PNIs und Bauten in Tagen. Keine Lieferengpässe, keine ausverkauften Routen, kein De-Peering.",
"rules.best_effort":"Best Effort",
"rules.bgp_at_3_a_m":"BGP um 3 Uhr nachts",
"rules.change_freeze":"Change Freeze",
"rules.chaos_calm":"Ruhig",
@ -3546,11 +3549,13 @@
"rules.like_the_real_game":"Wie im echten Spiel.",
"rules.more_and_longer_outages_more_ddos":"Fast doppelt so viele Ausfälle, anderthalbmal so lang, doppelt so viel DDoS. Alles an.",
"rules.no_clock_no_bills_nothing_breaks":"Keine Uhr, keine Rechnungen, nichts geht kaputt.",
"rules.no_sla_no_pager_no_promises":"Kein SLA, kein Pager, keine Versprechen. Nur Tubes.",
"rules.nobody_touches_prod_even_the_backhoes":"Niemand fasst Prod an. Sogar die Bagger sind im Urlaub.",
"rules.nothing_ever_breaks":"Nichts geht je kaputt.",
"rules.on_call":"Rufbereitschaft",
"rules.one_small_network_one_tricky_goal":"Ein kleines Netz, ein kniffliges Ziel.",
"rules.puzzle":"Rätsel",
"rules.rare_outages_no_ddos_no_conferences":"Seltene Ausfälle, kein DDoS, kein Chaos-Affe, keine Konferenzen. Seekabel heilen ohne Kabelschiffe, Bauten dauern Tage, Preise bleiben stabil. Geduldige Kunden, leise Benachrichtigungen und ein Rettungskredit statt Game Over.",
"rules.real_lead_times_real_outages_a_real":"Echte Lieferzeiten, echte Ausfälle, ein echter Markt. Das klassische Spiel.",
"rules.rules_are_locked_for_this_network":"{rules}: Die Regeln sind für dieses Netz festgelegt.",
"rules.the_real_thing_your_pager_has":"Das echte Spiel. Dein Pager hat Meinungen.",
@ -3647,8 +3652,10 @@
"settings.customers_and_alerts":"Kunden und Warnungen",
"settings.display_and_sound":"Anzeige und Ton",
"settings.for_reporting_layout_bugs_shows_what":"Zum Melden von Layout-Fehlern: zeigt, was dein Bildschirm dem Spiel mitteilt.",
"settings.only_trouble_and_milestones_pop_up":"Nur Ärger und Meilensteine poppen auf; alles andere landet still im NOC-Log. In Best Effort standardmäßig an.",
"settings.pause_on_outages_that_hurt":"Bei echten Ausfällen pausieren",
"settings.pause_when_a_customer_is_furious":"Bei wütenden Kunden pausieren",
"settings.quiet_notifications":"Leise Benachrichtigungen",
"settings.saved_on_this_device":"Auf diesem Gerät gespeichert.",
"settings.stops_the_game_when_a_failure":"Hält das Spiel an, wenn ein Ausfall dich echten Traffic kostet, nicht wenn der Traffic von selbst umgeleitet wird.",
"settings.the_game_stops_so_you_can":"Das Spiel hält an, damit du ihren Dienst reparieren kannst, bevor sie kündigen. Am nützlichsten bei hoher Geschwindigkeit.",

View file

@ -282,11 +282,13 @@
"bank.the_rest_is_due_at_the":"el resto vence al final",
"bank.then_about_price_at_once":"luego unos {price} de golpe",
"bank.you_pay_pct_of_your_transit":"Pagas el {pct} de tu factura de tránsito hasta saldar {price}.",
"banks.a_rescue_loan_of_amount_keeps":"Un préstamo de rescate de {amount} mantiene las luces encendidas: {pay} al mes durante cinco años, sin condiciones.",
"banks.always_open_ask_no_questions_do":"Siempre abierto. Sin preguntas. No llegues tarde.",
"banks.always_run_an_odd_number_of":"Gestiona siempre un número impar de POPs. Nuestro numerólogo insiste.",
"banks.bank_are_circling_they_now_take":"<b>{bank} te ronda.</b><br>Ahora se llevan el {pct} de tus ingresos.",
"banks.bank_is_unhappy_you_broke_a":"<b>{bank} está descontento.</b><br>Incumpliste una condición del préstamo: {cond} Arréglalo en 10 días o paga una penalización.",
"banks.bank_sign_is_in_retrograde_your":"<b>{bank}: {sign} está retrógrado.</b><br>Tu tasa ahora es del {apr} %.",
"banks.bank_stepped_in":"{bank} ha intervenido.",
"banks.bank_the_balloon_popped_the":"<b>{bank}: explotó el globo.</b><br>Los {price} restantes vencían hoy, de golpe. Ya salieron de tu cuenta.",
"banks.bank_would_like_to_lend_you":"<b>{bank} quiere prestarte {amount}.</b>",
"banks.cheap_patient_and_very_particular":"Barato, paciente y muy exigente con Stuttgart.",
@ -3533,6 +3535,7 @@
"rules.a_billion_dollars_every_unlock_your":"Mil millones de dólares, todo desbloqueado, tu propio cable submarino.",
"rules.a_cut_now_and_then":"Algún corte de vez en cuando.",
"rules.a_third_of_the_outages_no_ddos_pnis":"Un tercio de las caídas, sin DDoS. PNI y obras en días. Sin escasez, sin rutas agotadas, sin de-peering.",
"rules.best_effort":"Best Effort",
"rules.bgp_at_3_a_m":"BGP a las 3 de la mañana",
"rules.change_freeze":"Congelación de cambios",
"rules.chaos_calm":"Tranquilo",
@ -3544,11 +3547,13 @@
"rules.like_the_real_game":"Como el juego de verdad.",
"rules.more_and_longer_outages_more_ddos":"Casi el doble de caídas, la mitad más largas, el doble de DDoS. Todo activado.",
"rules.no_clock_no_bills_nothing_breaks":"Sin reloj, sin facturas, nada se rompe.",
"rules.no_sla_no_pager_no_promises":"Sin SLA, sin busca, sin promesas. Solo tubos.",
"rules.nobody_touches_prod_even_the_backhoes":"Nadie toca producción. Hasta las excavadoras están de vacaciones.",
"rules.nothing_ever_breaks":"Nunca se rompe nada.",
"rules.on_call":"De guardia",
"rules.one_small_network_one_tricky_goal":"Una red pequeña, un objetivo con truco.",
"rules.puzzle":"Puzle",
"rules.rare_outages_no_ddos_no_conferences":"Pocas averías, sin DDoS, sin mono del caos, sin conferencias. Los cortes submarinos se reparan sin barcos cableros, las obras tardan días, los precios no se mueven. Clientes pacientes, notificaciones discretas y un préstamo de rescate en vez de fin de partida.",
"rules.real_lead_times_real_outages_a_real":"Plazos reales, caídas reales, un mercado real. El juego clásico.",
"rules.rules_are_locked_for_this_network":"{rules}: las reglas están fijadas para esta red.",
"rules.the_real_thing_your_pager_has":"El juego de verdad. Tu busca tiene opiniones.",
@ -3645,8 +3650,10 @@
"settings.customers_and_alerts":"Clientes y alertas",
"settings.display_and_sound":"Pantalla y sonido",
"settings.for_reporting_layout_bugs_shows_what":"Para informar de fallos de diseño: muestra lo que tu pantalla le dice al juego.",
"settings.only_trouble_and_milestones_pop_up":"Solo aparecen los problemas y los hitos; todo lo demás va en silencio al registro del NOC. Activado por defecto en Best Effort.",
"settings.pause_on_outages_that_hurt":"Pausar con caídas que duelen",
"settings.pause_when_a_customer_is_furious":"Pausar cuando un cliente está furioso",
"settings.quiet_notifications":"Notificaciones discretas",
"settings.saved_on_this_device":"Guardado en este dispositivo.",
"settings.stops_the_game_when_a_failure":"Detiene el juego cuando un fallo te cuesta tráfico real, no cuando se reencamina solo.",
"settings.the_game_stops_so_you_can":"El juego se detiene para que arregles su servicio antes de que cancelen. Muy útil a alta velocidad.",

View file

@ -282,11 +282,13 @@
"bank.the_rest_is_due_at_the":"le reste est dû à la fin",
"bank.then_about_price_at_once":"puis environ {price} d’un coup",
"bank.you_pay_pct_of_your_transit":"Tu paies {pct} de ta facture de transit jusqu’à ce que {price} soit remboursé.",
"banks.a_rescue_loan_of_amount_keeps":"Un prêt de sauvetage de {amount} garde la lumière allumée : {pay} par mois pendant cinq ans, sans conditions.",
"banks.always_open_ask_no_questions_do":"Toujours ouvert. Pas de questions. Ne sois pas en retard.",
"banks.always_run_an_odd_number_of":"Garde toujours un nombre impair de POP. Notre numérologue insiste.",
"banks.bank_are_circling_they_now_take":"<b>{bank} tournoie au-dessus de toi.</b><br>Ils prennent maintenant {pct} de ton chiffre d’affaires.",
"banks.bank_is_unhappy_you_broke_a":"<b>{bank} n’est pas content.</b><br>Tu as enfreint une condition du prêt : {cond} Corrige ça sous 10 jours ou paie une pénalité.",
"banks.bank_sign_is_in_retrograde_your":"<b>{bank} : {sign} est rétrograde.</b><br>Ton taux passe à {apr} %.",
"banks.bank_stepped_in":"{bank} est intervenu.",
"banks.bank_the_balloon_popped_the":"<b>{bank} : le ballon a éclaté.</b><br>Les {price} restants étaient dus aujourd’hui, d’un seul coup. Ils ont quitté ton compte.",
"banks.bank_would_like_to_lend_you":"<b>{bank} aimerait te prêter {amount}.</b>",
"banks.cheap_patient_and_very_particular":"Pas chère, patiente et très à cheval sur Stuttgart.",
@ -3533,6 +3535,7 @@
"rules.a_billion_dollars_every_unlock_your":"Un milliard de dollars, tout débloqué, ton propre câble sous-marin.",
"rules.a_cut_now_and_then":"Une coupure de temps en temps.",
"rules.a_third_of_the_outages_no_ddos_pnis":"Un tiers des pannes, pas de DDoS. PNI et chantiers en quelques jours. Pas de pénurie, pas de routes épuisées, pas de dépeering.",
"rules.best_effort":"Best Effort",
"rules.bgp_at_3_a_m":"BGP à 3 h du matin",
"rules.change_freeze":"Gel des changements",
"rules.chaos_calm":"Calme",
@ -3544,11 +3547,13 @@
"rules.like_the_real_game":"Comme le vrai jeu.",
"rules.more_and_longer_outages_more_ddos":"Presque deux fois plus de pannes, moitié plus longues, deux fois plus de DDoS. Tout activé.",
"rules.no_clock_no_bills_nothing_breaks":"Pas d’horloge, pas de factures, rien ne casse.",
"rules.no_sla_no_pager_no_promises":"Pas de SLA, pas de bipeur, pas de promesses. Juste des tubes.",
"rules.nobody_touches_prod_even_the_backhoes":"Personne ne touche à la prod. Même les pelleteuses sont en vacances.",
"rules.nothing_ever_breaks":"Rien ne casse jamais.",
"rules.on_call":"D’astreinte",
"rules.one_small_network_one_tricky_goal":"Un petit réseau, un objectif retors.",
"rules.puzzle":"Casse-tête",
"rules.rare_outages_no_ddos_no_conferences":"Pannes rares, pas de DDoS, pas de singe du chaos, pas de conférences. Les coupures sous-marines se réparent sans navire câblier, les chantiers prennent des jours, les prix ne bougent pas. Clients patients, notifications discrètes et un prêt de sauvetage au lieu de la fin de partie.",
"rules.real_lead_times_real_outages_a_real":"De vrais délais, de vraies pannes, un vrai marché. Le jeu classique.",
"rules.rules_are_locked_for_this_network":"{rules} : les règles sont verrouillées pour ce réseau.",
"rules.the_real_thing_your_pager_has":"Le vrai jeu. Ton bipeur a des opinions.",
@ -3645,8 +3650,10 @@
"settings.customers_and_alerts":"Clients et alertes",
"settings.display_and_sound":"Affichage et son",
"settings.for_reporting_layout_bugs_shows_what":"Pour signaler des bugs de mise en page : montre ce que ton écran dit au jeu.",
"settings.only_trouble_and_milestones_pop_up":"Seuls les problèmes et les étapes s'affichent ; tout le reste va discrètement dans le journal du NOC. Activé par défaut en Best Effort.",
"settings.pause_on_outages_that_hurt":"Pause sur les pannes qui font mal",
"settings.pause_when_a_customer_is_furious":"Pause quand un client est furieux",
"settings.quiet_notifications":"Notifications discrètes",
"settings.saved_on_this_device":"Sauvegardées sur cet appareil.",
"settings.stops_the_game_when_a_failure":"Arrête le jeu quand une panne te coûte du vrai trafic, pas quand elle se reroute toute seule.",
"settings.the_game_stops_so_you_can":"Le jeu s’arrête pour que tu répares leur service avant qu’ils résilient. Surtout utile à grande vitesse.",

View file

@ -282,11 +282,13 @@
"bank.the_rest_is_due_at_the":"il resto si paga alla fine",
"bank.then_about_price_at_once":"poi circa {price} tutto insieme",
"bank.you_pay_pct_of_your_transit":"Paghi il {pct} della bolletta del transit finché non hai rimborsato {price}.",
"banks.a_rescue_loan_of_amount_keeps":"Un prestito di salvataggio di {amount} tiene accese le luci: {pay} al mese per cinque anni, senza condizioni.",
"banks.always_open_ask_no_questions_do":"Sempre aperti. Niente domande. Non fare tardi.",
"banks.always_run_an_odd_number_of":"Tieni sempre un numero dispari di POP. Il nostro numerologo insiste.",
"banks.bank_are_circling_they_now_take":"<b>{bank} ti girano intorno.</b><br>Ora si prendono il {pct} dei tuoi ricavi.",
"banks.bank_is_unhappy_you_broke_a":"<b>{bank} non è contenta.</b><br>Hai violato una condizione del prestito: {cond} Rimedia entro 10 giorni o paghi una penale.",
"banks.bank_sign_is_in_retrograde_your":"<b>{bank}: {sign} è retrogrado.</b><br>Il tuo tasso ora è {apr}%.",
"banks.bank_stepped_in":"{bank} è intervenuto.",
"banks.bank_the_balloon_popped_the":"<b>{bank}: il palloncino è scoppiato.</b><br>I {price} restanti scadevano oggi, tutti insieme. Sono usciti dal tuo conto.",
"banks.bank_would_like_to_lend_you":"<b>{bank} vorrebbe prestarti {amount}.</b>",
"banks.cheap_patient_and_very_particular":"Economica, paziente e fissata con Stuttgart.",
@ -3533,6 +3535,7 @@
"rules.a_billion_dollars_every_unlock_your":"Un miliardo di dollari, tutto sbloccato, il tuo cavo sottomarino.",
"rules.a_cut_now_and_then":"Un taglio ogni tanto.",
"rules.a_third_of_the_outages_no_ddos_pnis":"Un terzo dei guasti, niente DDoS. PNI e cantieri in pochi giorni. Niente carenze, niente rotte esaurite, niente de-peering.",
"rules.best_effort":"Best Effort",
"rules.bgp_at_3_a_m":"BGP alle 3 di notte",
"rules.change_freeze":"Change freeze",
"rules.chaos_calm":"Calmo",
@ -3544,11 +3547,13 @@
"rules.like_the_real_game":"Come il gioco vero.",
"rules.more_and_longer_outages_more_ddos":"Quasi il doppio dei guasti, lunghi una volta e mezza, il doppio dei DDoS. Tutto acceso.",
"rules.no_clock_no_bills_nothing_breaks":"Niente orologio, niente bollette, non si rompe niente.",
"rules.no_sla_no_pager_no_promises":"Niente SLA, niente cercapersone, niente promesse. Solo tubi.",
"rules.nobody_touches_prod_even_the_backhoes":"Nessuno tocca la produzione. Anche le ruspe sono in ferie.",
"rules.nothing_ever_breaks":"Non si rompe mai niente.",
"rules.on_call":"Reperibile",
"rules.one_small_network_one_tricky_goal":"Una piccola rete, un obiettivo insidioso.",
"rules.puzzle":"Rompicapo",
"rules.rare_outages_no_ddos_no_conferences":"Guasti rari, niente DDoS, niente scimmia del caos, niente conferenze. I tagli sottomarini si riparano senza navi posacavi, i cantieri durano giorni, i prezzi restano fermi. Clienti pazienti, notifiche discrete e un prestito di salvataggio invece del game over.",
"rules.real_lead_times_real_outages_a_real":"Tempi di consegna veri, guasti veri, un mercato vero. Il gioco classico.",
"rules.rules_are_locked_for_this_network":"{rules}: le regole sono bloccate per questa rete.",
"rules.the_real_thing_your_pager_has":"Il gioco vero. Il tuo cercapersone ha delle opinioni.",
@ -3645,8 +3650,10 @@
"settings.customers_and_alerts":"Clienti e avvisi",
"settings.display_and_sound":"Schermo e audio",
"settings.for_reporting_layout_bugs_shows_what":"Per segnalare bug di layout: mostra cosa lo schermo dice al gioco.",
"settings.only_trouble_and_milestones_pop_up":"Compaiono solo i problemi e i traguardi; tutto il resto finisce in silenzio nel registro del NOC. Attivo di default in Best Effort.",
"settings.pause_on_outages_that_hurt":"Pausa sui guasti che fanno male",
"settings.pause_when_a_customer_is_furious":"Pausa quando un cliente è furioso",
"settings.quiet_notifications":"Notifiche discrete",
"settings.saved_on_this_device":"Salvate su questo dispositivo.",
"settings.stops_the_game_when_a_failure":"Ferma il gioco quando un guasto ti costa traffico vero, non quando si reinstrada da solo.",
"settings.the_game_stops_so_you_can":"Il gioco si ferma così puoi sistemare il servizio prima che disdicano. Utilissimo ad alta velocità.",

View file

@ -282,11 +282,13 @@
"bank.the_rest_is_due_at_the":"o resto vence no fim",
"bank.then_about_price_at_once":"depois cerca de {price} de uma vez",
"bank.you_pay_pct_of_your_transit":"Você paga {pct} da sua conta de transit até quitar {price}.",
"banks.a_rescue_loan_of_amount_keeps":"Um empréstimo de resgate de {amount} mantém as luzes acesas: {pay} por mês durante cinco anos, sem condições.",
"banks.always_open_ask_no_questions_do":"Sempre aberto. Sem perguntas. Não se atrase.",
"banks.always_run_an_odd_number_of":"Sempre tenha um número ímpar de POPs. Nosso numerólogo insiste.",
"banks.bank_are_circling_they_now_take":"<b>{bank} estão rondando.</b><br>Agora eles levam {pct} da sua receita.",
"banks.bank_is_unhappy_you_broke_a":"<b>{bank} não está feliz.</b><br>Você violou uma condição do empréstimo: {cond} Resolva em 10 dias ou pague uma multa.",
"banks.bank_sign_is_in_retrograde_your":"<b>{bank}: {sign} está retrógrado.</b><br>Sua taxa agora é {apr}%.",
"banks.bank_stepped_in":"{bank} interveio.",
"banks.bank_the_balloon_popped_the":"<b>{bank}: o balão estourou.</b><br>Os {price} restantes venceram hoje, todos de uma vez. Já saíram da sua conta.",
"banks.bank_would_like_to_lend_you":"<b>{bank} quer te emprestar {amount}.</b>",
"banks.cheap_patient_and_very_particular":"Barato, paciente e muito exigente com Stuttgart.",
@ -3533,6 +3535,7 @@
"rules.a_billion_dollars_every_unlock_your":"Um bilhão de dólares, tudo desbloqueado, o seu próprio cabo submarino.",
"rules.a_cut_now_and_then":"Um corte de vez em quando.",
"rules.a_third_of_the_outages_no_ddos_pnis":"Um terço das falhas, sem DDoS. PNIs e obras em dias. Sem escassez, sem rotas esgotadas, sem de-peering.",
"rules.best_effort":"Best Effort",
"rules.bgp_at_3_a_m":"BGP às 3 da manhã",
"rules.change_freeze":"Congelamento de mudanças",
"rules.chaos_calm":"Calmo",
@ -3544,11 +3547,13 @@
"rules.like_the_real_game":"Como o jogo de verdade.",
"rules.more_and_longer_outages_more_ddos":"Quase o dobro de falhas, metade mais longas, o dobro de DDoS. Tudo ligado.",
"rules.no_clock_no_bills_nothing_breaks":"Sem relógio, sem contas, nada quebra.",
"rules.no_sla_no_pager_no_promises":"Sem SLA, sem pager, sem promessas. Só tubos.",
"rules.nobody_touches_prod_even_the_backhoes":"Ninguém mexe em produção. Até as retroescavadeiras estão de férias.",
"rules.nothing_ever_breaks":"Nada quebra nunca.",
"rules.on_call":"De plantão",
"rules.one_small_network_one_tricky_goal":"Uma rede pequena, um objetivo traiçoeiro.",
"rules.puzzle":"Quebra-cabeça",
"rules.rare_outages_no_ddos_no_conferences":"Falhas raras, sem DDoS, sem macaco do caos, sem conferências. Cortes submarinos se reparam sem navios cabreiros, obras levam dias, preços não mudam. Clientes pacientes, notificações discretas e um empréstimo de resgate em vez de fim de jogo.",
"rules.real_lead_times_real_outages_a_real":"Prazos reais, falhas reais, um mercado real. O jogo clássico.",
"rules.rules_are_locked_for_this_network":"{rules}: as regras estão travadas para esta rede.",
"rules.the_real_thing_your_pager_has":"O jogo de verdade. O seu pager tem opiniões.",
@ -3645,8 +3650,10 @@
"settings.customers_and_alerts":"Clientes e alertas",
"settings.display_and_sound":"Tela e som",
"settings.for_reporting_layout_bugs_shows_what":"Para reportar bugs de layout: mostra o que sua tela informa ao jogo.",
"settings.only_trouble_and_milestones_pop_up":"Só aparecem problemas e marcos; todo o resto vai em silêncio para o registro do NOC. Ligado por padrão no Best Effort.",
"settings.pause_on_outages_that_hurt":"Pausar em falhas que doem",
"settings.pause_when_a_customer_is_furious":"Pausar quando um cliente estiver furioso",
"settings.quiet_notifications":"Notificações discretas",
"settings.saved_on_this_device":"Salvo neste dispositivo.",
"settings.stops_the_game_when_a_failure":"Para o jogo quando uma falha custa tráfego de verdade, não quando ela se reroteia sozinha.",
"settings.the_game_stops_so_you_can":"O jogo para para você consertar o serviço antes que cancelem. Muito útil em alta velocidade.",

View file

@ -3,29 +3,35 @@
these rules, not separate code: Normal comes as Change Freeze, On-call (the classic game) and BGP at 3 a.m.;
Sandbox and Puzzles are presets too. Saves without rules load as On-call, so nothing changes for them.
Scenarios and the weekly challenge run on On-call plus their own S.scn.rules (scnRule()). */
const RULE_DEF={clock:true,chaos:'normal',lead:'real',market:true,money:'normal',gates:'ladder',mods:[]};
const RULE_OK={clock:[true,false],chaos:['none','calm','normal','spicy'],lead:['real','quick'],market:[true,false],money:['normal','infinite'],gates:['ladder','open']};
// sea: cable ships sail out to subsea cuts, or (timer) a cut mends on its own clock. confs: conference season.
// broke: deep in the red ends the game, or (rescue) a state loan keeps it going. moods: patient customers sour half as fast.
const RULE_DEF={clock:true,chaos:'normal',lead:'real',market:true,money:'normal',gates:'ladder',sea:'ships',confs:true,broke:'lose',moods:'normal',mods:[]};
const RULE_LATE=['sea','confs','broke','moods'];
const RULE_OK={clock:[true,false],chaos:['none','calm','normal','spicy'],lead:['real','quick'],market:[true,false],money:['normal','infinite'],gates:['ladder','open'],sea:['ships','timer'],confs:[true,false],broke:['lose','rescue'],moods:['normal','patient']};
// i: icon, n: name, d: the one-line joke, x: what is different, in small print.
const PRESETS={
soft:{i:'☕',n:tr('rules.best_effort'),d:tr('rules.no_sla_no_pager_no_promises'),x:tr('rules.rare_outages_no_ddos_no_conferences'),clock:true,chaos:'calm',lead:'quick',market:false,money:'normal',gates:'ladder',sea:'timer',confs:false,broke:'rescue',moods:'patient'},
freeze:{i:'🧊',n:tr('rules.change_freeze'),d:tr('rules.nobody_touches_prod_even_the_backhoes'),x:tr('rules.a_third_of_the_outages_no_ddos_pnis'),clock:true,chaos:'calm',lead:'quick',market:false,money:'normal',gates:'ladder'},
oncall:{i:'📟',n:tr('rules.on_call'),d:tr('rules.the_real_thing_your_pager_has'),x:tr('rules.real_lead_times_real_outages_a_real'),clock:true,chaos:'normal',lead:'real',market:true,money:'normal',gates:'ladder'},
bgp:{i:'🔥',n:tr('rules.bgp_at_3_a_m'),d:tr('rules.everything_is_on_fire_and_it'),x:tr('rules.more_and_longer_outages_more_ddos'),clock:true,chaos:'spicy',lead:'real',market:true,money:'normal',gates:'ladder'},
sandbox:{i:'🏖️',n:tr('common.sandbox'),d:tr('rules.a_billion_dollars_every_unlock_your'),x:tr('rules.infinite_money_everything_unlocked_quick'),clock:true,chaos:'none',lead:'quick',market:true,money:'infinite',gates:'open'},
puzzle:{i:'🧩',n:tr('rules.puzzle'),d:tr('rules.one_small_network_one_tricky_goal'),x:tr('rules.no_clock_no_bills_nothing_breaks'),clock:false,chaos:'none',lead:'quick',market:false,money:'normal',gates:'open'},
};
const NORMAL_PRESETS=['freeze','oncall','bgp'];
const NORMAL_PRESETS=['soft','freeze','oncall','bgp'];
// How often things break, against the classic game. Spicy outages also last half as long again.
const CHAOS={none:{i:'😴',n:tr('rules.chaos_none'),d:tr('rules.nothing_ever_breaks'),m:0},calm:{i:'🧊',n:tr('rules.chaos_calm'),d:tr('rules.a_cut_now_and_then'),m:0.35},normal:{i:'📟',n:tr('rules.chaos_normal'),d:tr('rules.like_the_real_game'),m:1},spicy:{i:'🔥',n:tr('rules.chaos_spicy'),d:tr('rules.your_pager_never_sleeps'),m:1.8}};
const SPICY_LONG=1.5,LEAD_QUICK=10;
function rule(k){const r=S&&S.rules;return r&&r[k]!==undefined?r[k]:RULE_DEF[k];}
function rulePreset(){const p=S&&S.rules&&S.rules.preset;return p&&Object.prototype.hasOwnProperty.call(PRESETS,p)?p:'oncall';}
const shipsOn=()=>rule('sea')!=='timer',confsOn=()=>rule('confs')!==false;
function gatesOpen(){return rule('gates')==='open';}
function chaosMul(){const c=CHAOS[rule('chaos')];return c?c.m:1;}
// Days until something ordered arrives: as quoted, or a tenth of it (at least a day) with quick lead times.
function leadDays(n){return rule('lead')==='quick'?Math.max(1,Math.round(n/LEAD_QUICK)):n;}
// A fresh, valid rules object: the preset's values, with any valid overrides on top.
function makeRules(preset,o){const p=Object.prototype.hasOwnProperty.call(PRESETS,preset)?preset:'oncall',P=PRESETS[p],r={preset:p};o=o&&typeof o==='object'?o:{};
for(const k of Object.keys(RULE_OK)){const d=P[k]!==undefined?P[k]:RULE_DEF[k];r[k]=RULE_OK[k].includes(o[k])?o[k]:d;}
// The later rules are written only where they differ from the classic game, so older networks' rules stay as they were.
for(const k of Object.keys(RULE_OK)){const d=P[k]!==undefined?P[k]:RULE_DEF[k],v=RULE_OK[k].includes(o[k])?o[k]:d;if(!RULE_LATE.includes(k)||v!==RULE_DEF[k])r[k]=v;}
r.mods=Array.isArray(o.mods)?[...new Set(o.mods.filter(m=>typeof m==='string'&&/^[a-z0-9_-]{1,24}$/.test(m)))].slice(0,16):[];
return r;}
// What the HUD and the share card say about the rules. On-call says nothing: it is the game.

View file

@ -78,6 +78,13 @@ function spawnLoanOffer(emergency){
S.loanOffers.push(o);
toast(tr('banks.bank_would_like_to_lend_you',{bank:esc(B.name),amount:fmt$(amount)})+'<br>'+(emergency?tr('banks.they_heard_you_might_be_in'):tr('banks.terms_apply_several_terms')),emergency?'bad':'goal',[{l:tr('common.open_bank'),act:'bank',args:{}}]);
}
// Best Effort has no game over: deep in the red, the Ministry of Tubes lends what it takes to be back in the black,
// cheap, over five years, no conditions. The repayments are still yours.
const RESCUE_APR=0.02,RESCUE_TERM=60;
function rescueLoan(){const amount=niceAmt(Math.max(250000,-S.cash+Math.max(150000,(R.costMo||0)*2)));
S.cash+=amount;S.stats.rescues=(S.stats.rescues||0)+1;S.neg=0;
S.loans.push({id:uid(),bank:'gov',start:S.day,amount,got:amount,bal:amount,apr:RESCUE_APR,apr0:RESCUE_APR,pay:Math.round(annuity(amount,RESCUE_APR,RESCUE_TERM)),left:RESCUE_TERM,term:RESCUE_TERM,share:0,covs:[],base:{sub:S.links.filter(x=>x.sub).length}});
track('rescue');toast(`<b>${tr('banks.bank_stepped_in',{bank:esc(BANKS.gov.name)})}</b><br>${tr('banks.a_rescue_loan_of_amount_keeps',{amount:fmt$(amount),pay:fmt$(Math.round(annuity(amount,RESCUE_APR,RESCUE_TERM)))})}`,'bad',[{l:tr('common.open_bank'),act:'bank',args:{}}]);sfx('coin');}
function loanTick(d){
// conditions: 15-day grace, then a penalty every 30 days while broken
for(const l of S.loans){const B=BANKS[l.bank];

View file

@ -8,7 +8,8 @@ const confSp=cf=>!cf.cap&&[...cf.key].reduce((a,ch)=>(a*31+ch.charCodeAt(0))>>>0
const confCost=cf=>cf.cap?CAP_COST:CONF_COST;
const confDay=(cf,y)=>dayOf(y+1,cf.m,10);
function confKey(cf,y){return cf.n+'@'+cf.c+'@'+y;}
function upcomingConfs(within){const y0=cal(S.day).y-1,out=[];for(const y of [y0,y0+1])for(const cf of CONFS){const d=confDay(cf,y);if(d>=S.day&&d-S.day<=within)out.push({...cf,day:d,key:confKey(cf,y)});}return out.sort((a,b)=>a.day-b.day);}
// No conference season in Best Effort: nothing to register for, nothing in the panel, no invitations.
function upcomingConfs(within){if(!confsOn())return [];const y0=cal(S.day).y-1,out=[];for(const y of [y0,y0+1])for(const cf of CONFS){const d=confDay(cf,y);if(d>=S.day&&d-S.day<=within)out.push({...cf,day:d,key:confKey(cf,y)});}return out.sort((a,b)=>a.day-b.day);}
function confBoost(id){const cb=S.conf;if(!cb||!(cb.until>S.day))return 1;const n=NET[id];return n&&n.pops.some(c=>CITY[c]&&CITY[c].reg===cb.reg)?0.5:1;}
function confTick(d){S.confReg=S.confReg||{};
for(const cf of upcomingConfs(30)){if(cf.day-d===30&&!S.confReg[cf.key])toast(tr('conferences.conf_comes_to_city_in_30',{conf:esc(cf.n),city:esc(CITY[cf.c].name)}),'goal',[{l:tr('common.show_me'),act:'leftTab',args:{t:'deals'}}]);}

View file

@ -86,7 +86,8 @@ function fireFailure(only){
const en=l.sub&&(CITY[l.a].au||CITY[l.b].au)&&!(l.cable&&CAB[l.cable].fragile)&&Math.random()<0.35?pick([N_('failures.box_jellyfish_season_at_the_a'),N_('failures.a_great_white_took_an_interest')]):l.cable&&CAB[l.cable].fragile&&Math.random()<0.8?pick([N_('failures.your_a_b_cable_is_cut'),N_('failures.a_b_is_down_same_cable')]):!l.sub&&CITY[l.a].land==='nzs'&&CITY[l.b].land==='nzs'&&Math.random()<0.75?pick([N_('failures.a_kea_pulled_the_rubber_seals'),N_('failures.the_sandflies_drove_your_splicing'),N_('failures.a_farmer_s_post_hole_digger')]):l.cable==='cook'&&Math.random()<0.6?N_('failures.a_ferry_dropped_anchor_in_cook'):!l.sub&&au&&Math.random()<0.75?pick([N_('failures.a_sulphur_crested_cockatoo_chewed'),N_('failures.a_kangaroo_hit_the_fiber_hut'),N_('failures.thieves_dug_up_your_a_b'),N_('failures.a_kilometre_of_copper_went_missing'),N_('failures.a_backhoe_putting_in_a_new'),N_('failures.the_emus_won_again_a_mob'),N_('failures.a_kangaroo_boxed_your_field_tech'),N_('failures.a_drop_bear_fell_on_the'),N_('failures.an_eastern_brown_snake_moved_into'),...((S.day%365)/30.42>=8&&(S.day%365)/30.42<11?[N_('failures.magpie_swooping_season_the_field')]:[]),...(auSummer?[N_('failures.bushfire_season_the_fiber_along_a')]:[]),...(nullPair(l.a,l.b)?[N_('failures.your_a_b_fiber_broke_somewhere')]:[])]):l.sub&&(l.a==='bda'||l.b==='bda')&&Math.random()<0.7?pick([N_('failures.your_a_b_cable_went_quiet'),N_('failures.the_repair_ship_s_compass_spun')]):l.sub&&(l.a==='tbu'||l.b==='tbu')&&Math.random()<0.7?pick([N_('failures.an_undersea_volcano_erupted_next_to'),N_('failures.the_seabed_off_tonga_slid_down')]):vn(l)&&Math.random()<0.8?pick([N_('failures.another_of_vietnam_s_subsea_cables'),N_('failures.your_a_b_cable_broke_in')]):!l.sub&&(l.a==='drw'||l.b==='drw')&&Math.random()<0.7?pick([N_('failures.a_crocodile_took_a_bite_out'),N_('failures.termites_ate_the_duct_on_a')]):tw(l)&&Math.random()<0.8?pick([N_('failures.a_cargo_ship_forgot_to_raise'),N_('failures.another_anchor_another_cut_your_a'),N_('failures.a_fishing_boat_with_an_unusually')]):l.sub&&(l.a==='oos'||l.b==='oos')&&Math.random()<0.8?pick([N_('failures.a_trawler_off_ostend_dragged_its'),N_('failures.a_wind_farm_service_vessel_dropped')]):!l.sub&&(CITY[l.a].ca||CITY[l.b].ca)&&Math.random()<0.4?pick([N_('failures.a_beaver_chewed_through_your_a'),N_('failures.your_a_b_fiber_is_down'),N_('failures.frost_heave_cracked_the_duct_on')]):!l.sub&&andesPair(l.a,l.b)?pick([N_('failures.a_landslide_in_the_andes_buried'),N_('failures.snow_closed_the_mountain_pass_and'),N_('failures.an_earthquake_shook_your_a_b'),N_('failures.a_llama_herd_trampled_the_fiber')]):!l.sub&&(CITY[l.a].india||CITY[l.b].india)?pick([N_('failures.road_widening_near_a_cut_your'),N_('failures.the_monsoon_flooded_a_manhole_on'),N_('failures.a_digger_found_your_a_b')]):l.sub?pick([N_('failures.a_curious_shark_bit_your_subsea'),N_('failures.a_ship_dragged_its_anchor_across'),N_('failures.an_undersea_landslide_snapped_a_b')]):pick([N_('failures.a_backhoe_found_your_fiber_between'),N_('failures.squirrels_chewed_through_a_b_they'),N_('failures.road_works_cut_a_b_nobody')]);
addInc({type,ref:trc,until:S.day+dur,msg:tr(en,{a:A,b:B})+(hit.length>1?' '+tr('failures.all_n_links_in_that_trench',{n:hit.length}):''),cost:Math.max(4000,Math.round(hit.reduce((a,x)=>a+x.mo,0)*0.5))},en);
// At sea a cable ship sails out to it (50-cable-ships.js): it sets how long the cut lasts and what a charter costs.
if(l.sub&&!pzOn())shipCut(S.inc[S.inc.length-1],l);
// Without ships (Best Effort) a sea cut mends on the same clock as one on land.
if(l.sub&&!pzOn()&&shipsOn())shipCut(S.inc[S.inc.length-1],l);
}else if(type==='crash'||type==='power'){
const c=pick(Object.keys(S.pops).flatMap(x=>type==='power'&&(CITY[x].za||CITY[x].blackout)?[x,x,x]:type==='crash'&&RG[S.pops[x].rgen||0].flaky?[x,x,x]:[x])),pp=S.pops[c],slow=slowBoot(c),dur=(type==='crash'?2+Math.floor(Math.random()*2):3+Math.floor(Math.random()*3))*(type==='crash'&&S.ev.sanction>S.day?2:1)+(slow?2+Math.floor(Math.random()*3):0);
if(type==='crash'&&(pp.routers||1)>=2){pp.rdown=S.day+dur;S.stats.incidents++;S.stats.survived++;toast(tr('failures.router_crash_in_city_one_router',{city:CITY[c].name,slow:slow?' '+tr('failures.the_crashed_one_what',{what:esc(pick(SLOW_BOOT))}):'',d:dur}),'good');sfx('alert');return;}

View file

@ -1,7 +1,8 @@
/* ---------- daily tick ---------- */
/* A day is two halves around its routing: dayPre() (the world moves on), compute(), dayPost() (bills, moods, offers).
In play the routing can run in a worker in between (28-route-worker.js); tests and the fallback run it in one go. */
function dayTick(){const d=dayPre();if(d===false)return;compute();dayPost(d);}
// UI.tick: what the day itself announces, which quiet notifications may keep to the NOC log.
function dayTick(){UI.tick=true;try{const d=dayPre();if(d===false)return;compute();dayPost(d);}finally{UI.tick=false;}}
function dayPre(){
if(!S||S.lost||!rule('clock'))return false; // no clock (puzzles): no days, no bills, nothing fires
S.day++;
@ -47,7 +48,7 @@ function dayPost(d){
(a.sla||(a.sla=[])).push(b.id);b.slaFor=a.start;S.cash-=SLA_PEN;b.mood=Math.max(0,b.mood-18);S.stats.sla=(S.stats.sla||0)+1;
toast(tr('day_tick.sla_breach_name_the_attack_on',{name:esc(b.name),city:CITY[a.city].name,pen:fmt$(SLA_PEN)}),'bad');sfx('err');}}
// businesses mood
const ids=linkIds(),frr=coreFrr()&&S.links.some(l=>l.cut)?.5:1;const bhT=new Set(ddosAll().filter(a=>a.bh).map(a=>a.tgt));for(const b of S.biz.slice()){if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;if(bhT.has(b.id))continue;const sf=bizSf(b,ids),reachOk=BIZ_T[b.type].l2||BIZ_T[b.type].fiber||R.reach>0.99||scnRule('local'),scrubOk=b.type!=='scrub'||(hasScrub()&&!scrubFar(b.city)),divOk=reqOk(b);
const ids=linkIds(),frr=(coreFrr()&&S.links.some(l=>l.cut)?.5:1)*(rule('moods')==='patient'?.5:1);const bhT=new Set(ddosAll().filter(a=>a.bh).map(a=>a.tgt));for(const b of S.biz.slice()){if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;if(bhT.has(b.id))continue;const sf=bizSf(b,ids),reachOk=BIZ_T[b.type].l2||BIZ_T[b.type].fiber||R.reach>0.99||scnRule('local'),scrubOk=b.type!=='scrub'||(hasScrub()&&!scrubFar(b.city)),divOk=reqOk(b);
if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2);
else if(S.day-(b.since||0)<15){}
else{b.mood-=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));
@ -87,7 +88,7 @@ function dayPost(d){
// money trouble
if(S.cash<0){S.neg++;if(S.neg===1)toast(tr('day_tick.you_are_in_the_red_cancel'),'bad');}
else S.neg=0;
if(S.cash<-100000){S.lost=true;track('bankrupt');showLose();return;}
if(S.cash<-100000){if(rule('broke')==='rescue')rescueLoan();else{S.lost=true;track('bankrupt');showLose();return;}}
{const c=cal(d);if(c.m===0&&c.d===1&&[2,3,5].includes(c.y))track('game_year_'+c.y,true);}
if(d%10===0)save();
}

View file

@ -85,7 +85,8 @@ const BVAR={freeze:{k:'freeze',lv:1,i:'🧊',n:N_('badges.variant_freeze_dried')
const BVAR_IDS=['freeze','oncall','bgp'],bvar=k=>own(BVAR,k)?BVAR[k]:BVAR.oncall;
// The preset this save plays under ('oncall' for every save from before rulesets), and the variant it earns (null: none).
const rulePre=()=>(typeof rulePreset==='function'?rulePreset():(S&&S.rules&&S.rules.preset))||'oncall';
function badgeVar(){if(!S||S.mode==='sandbox')return null;const p=rulePre();return p==='sandbox'||p==='puzzle'?null:own(BVAR,p)?p:'oncall';}
// Best Effort earns the gentlest variant, Freeze-dried.
function badgeVar(){if(!S||S.mode==='sandbox')return null;const p=rulePre();return p==='sandbox'||p==='puzzle'?null:p==='soft'?'freeze':own(BVAR,p)?p:'oncall';}
// The hall of fame is this device's localStorage, so it is checked like a save: unknown variants count as standard.
function hof(){let h;try{h=JSON.parse(localStorage.getItem('sot-badges')||'{}');}catch(e){h=null;}if(!h||typeof h!=='object'||Array.isArray(h))return {};
for(const k of Object.keys(h)){const x=h[k];if(!x||typeof x!=='object'){delete h[k];continue;}const vs=x.vs&&typeof x.vs==='object'&&!Array.isArray(x.vs)?x.vs:{};

View file

@ -1,6 +1,8 @@
/* ---------- toasts & modals ---------- */
function toast(html,kind='',actions=[],open=null){
if(S)logNote(html,kind,actions,open);
// Quiet notifications: what the day announces pops up only for trouble and milestones; the rest stays in the NOC log.
if(UI.tick&&kind!=='bad'&&kind!=='goal'&&quietOn())return;
const el=document.createElement('div');el.className='toast '+kind;el.dataset.born=performance.now();
el.innerHTML=`<div class="tx">${html}</div>${actions.map(a=>btn(a.l,a.act,a.args,'sm')).join('')}`;
const box=$('toasts');box.prepend(el);const max=innerWidth<760?2:3;while(box.children.length>max)box.lastChild.remove();

View file

@ -9,20 +9,23 @@ const langPick=id=>`<select class="pick" id="${id}" data-chg="langSet" aria-labe
function segBtns(act,cur,opts){return opts.map(([v,l])=>btn(l,act,{v},cur===v?'pink sm':'ghost sm')).join('');}
/* Animation setting: auto follows the system's reduced-motion preference, or force it on or off. */
/* Settings are per device (localStorage), not part of the save: they are about how you like to play. */
const PREF_DEF={pauseFurious:true,warnUnhappy:true,pauseIncident:false};
const PREF_DEF={pauseFurious:true,warnUnhappy:true,pauseIncident:false,quiet:false};
let PREFS=(()=>{try{const j=JSON.parse(localStorage.getItem('sot-prefs')||'{}');return j&&typeof j==='object'?j:{};}catch(e){return {};}})();
const pref=k=>typeof PREFS[k]==='boolean'?PREFS[k]:PREF_DEF[k];
// Quiet notifications: the player's choice once made, until then on in Best Effort only.
const quietOn=()=>typeof PREFS.quiet==='boolean'?PREFS.quiet:rulePreset()==='soft';
function setPref(k,v){if(!own(PREF_DEF,k))return;PREFS[k]=!!v;try{localStorage.setItem('sot-prefs',JSON.stringify(PREFS));}catch(e){}}
// Stop the clock for something the player must see. Nothing happens if the game is already paused.
function autoPause(){if(!S||!UI.speed)return false;UI.resumeSpeed=UI.speed;UI.speed=0;renderHUD();return true;}
const resumeAct=()=>({l:tr('common.resume'),act:'speed',args:{v:UI.resumeSpeed||1}});
function settingsHtml(){const seg=(lab,act,cur,opts,note)=>`<div class="setline"><span>${lab}</span><div class="seg">${segBtns(act,cur,opts)}</div></div>${note?`<p class="meta" style="margin:0 0 6px">${note}</p>`:''}`;
const onoff=k=>[[k+':1',tr('common.on')],[k+':0',tr('common.off')]],cur=k=>k+':'+(pref(k)?1:0);
const onoff=k=>[[k+':1',tr('common.on')],[k+':0',tr('common.off')]],cur=k=>k+':'+((k==='quiet'?quietOn():pref(k))?1:0);
return `<div style="display:flex;align-items:center"><h2 style="font-size:26px">⚙️ ${tr('common.settings')}</h2><button class="x" data-act="settingsClose" aria-label="${tr('common.close')}">×</button></div><p class="tagline">${tr('settings.saved_on_this_device')}</p>
<h3 class="sub4">${tr('settings.customers_and_alerts')}</h3>
${seg(tr('settings.pause_when_a_customer_is_furious'),'prefSet',cur('pauseFurious'),onoff('pauseFurious'),tr('settings.the_game_stops_so_you_can'))}
${seg(tr('settings.warn_when_a_customer_gets_unhappy'),'prefSet',cur('warnUnhappy'),onoff('warnUnhappy'),tr('settings.an_early_heads_up_below_60'))}
${seg(tr('settings.pause_on_outages_that_hurt'),'prefSet',cur('pauseIncident'),onoff('pauseIncident'),tr('settings.stops_the_game_when_a_failure'))}
${seg(tr('settings.quiet_notifications'),'prefSet',cur('quiet'),onoff('quiet'),tr('settings.only_trouble_and_milestones_pop_up'))}
<h3 class="sub4">${tr('settings.display_and_sound')}</h3>
${seg(tr('common.animations'),'animSet',UI.anim||'auto',[['auto',tr('common.auto')],['on',tr('common.on')],['off',tr('common.off')]],tr('settings.auto_follows_your_device_s_reduce'))}
${seg(tr('common.sound'),'soundSet',UI.muted?'off':'on',[['on',tr('common.on')],['off',tr('common.off')]])}

View file

@ -283,11 +283,13 @@
"bank.the_rest_is_due_at_the":"the rest is due at the end",
"bank.then_about_price_at_once":"then about {price} at once",
"bank.you_pay_pct_of_your_transit":"You pay {pct} of your transit bill until {price} is repaid.",
"banks.a_rescue_loan_of_amount_keeps":"A rescue loan of {amount} keeps the lights on: {pay} a month for five years, no conditions.",
"banks.always_open_ask_no_questions_do":"Always open. Ask no questions. Do not be late.",
"banks.always_run_an_odd_number_of":"Always run an odd number of POPs. Our numerologist insists.",
"banks.bank_are_circling_they_now_take":"<b>{bank} are circling.</b><br>They now take {pct} of your revenue.",
"banks.bank_is_unhappy_you_broke_a":"<b>{bank} is unhappy.</b><br>You broke a loan condition: {cond} Fix it within 10 days or pay a penalty.",
"banks.bank_sign_is_in_retrograde_your":"<b>{bank}: {sign} is in retrograde.</b><br>Your rate is now {apr}%.",
"banks.bank_stepped_in":"{bank} stepped in.",
"banks.bank_the_balloon_popped_the":"<b>{bank}: the balloon popped.</b><br>The remaining {price} was due today, all at once. It has left your account.",
"banks.bank_would_like_to_lend_you":"<b>{bank} would like to lend you {amount}.</b>",
"banks.cheap_patient_and_very_particular":"Cheap, patient, and very particular about Stuttgart.",
@ -3534,6 +3536,7 @@
"rules.a_billion_dollars_every_unlock_your":"A billion dollars, every unlock, your own subsea cable.",
"rules.a_cut_now_and_then":"A cut now and then.",
"rules.a_third_of_the_outages_no_ddos_pnis":"A third of the outages, no DDoS. PNIs and builds in days. No shortages, no sold-out routes, no de-peering.",
"rules.best_effort":"Best Effort",
"rules.bgp_at_3_a_m":"BGP at 3 a.m.",
"rules.change_freeze":"Change Freeze",
"rules.chaos_calm":"Calm",
@ -3545,11 +3548,13 @@
"rules.like_the_real_game":"Like the real game.",
"rules.more_and_longer_outages_more_ddos":"Almost twice the outages, half as long again, twice the DDoS. Everything on.",
"rules.no_clock_no_bills_nothing_breaks":"No clock, no bills, nothing breaks.",
"rules.no_sla_no_pager_no_promises":"No SLA, no pager, no promises. Just tubes.",
"rules.nobody_touches_prod_even_the_backhoes":"Nobody touches prod. Even the backhoes are on holiday.",
"rules.nothing_ever_breaks":"Nothing ever breaks.",
"rules.on_call":"On-call",
"rules.one_small_network_one_tricky_goal":"One small network, one tricky goal.",
"rules.puzzle":"Puzzle",
"rules.rare_outages_no_ddos_no_conferences":"Rare outages, no DDoS, no chaos monkey, no conferences. Sea cuts mend without cable ships, builds take days, prices stay put. Patient customers, quiet notifications, and a rescue loan instead of game over.",
"rules.real_lead_times_real_outages_a_real":"Real lead times, real outages, a real market. The classic game.",
"rules.rules_are_locked_for_this_network":"{rules}: rules are locked for this network.",
"rules.the_real_thing_your_pager_has":"The real thing. Your pager has opinions.",
@ -3646,8 +3651,10 @@
"settings.customers_and_alerts":"Customers and alerts",
"settings.display_and_sound":"Display and sound",
"settings.for_reporting_layout_bugs_shows_what":"For reporting layout bugs: shows what your screen tells the game.",
"settings.only_trouble_and_milestones_pop_up":"Only trouble and milestones pop up; everything else goes quietly into the NOC log. On by default in Best Effort.",
"settings.pause_on_outages_that_hurt":"Pause on outages that hurt",
"settings.pause_when_a_customer_is_furious":"Pause when a customer is furious",
"settings.quiet_notifications":"Quiet notifications",
"settings.saved_on_this_device":"Saved on this device.",
"settings.stops_the_game_when_a_failure":"Stops the game when a failure costs you real traffic, not when it reroutes by itself.",
"settings.the_game_stops_so_you_can":"The game stops so you can fix their service before they cancel. Most useful at high speed.",

View file

@ -135,7 +135,7 @@ input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radi
.door.on,.preset.on,.chs.on{background:#FFE3F0;border-color:var(--me);box-shadow:0 4px 0 var(--me)}
.door.on::after,.preset.on::after,.chs.on::after{content:"✓";position:absolute;top:6px;right:9px;font:900 15px var(--display);color:var(--me)}
.door[data-door=puzzle],.door[data-door=scn]{background:var(--soft)}
.presets{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.presets{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.preset small{font-size:11px;color:var(--ink2);line-height:1.3;margin-top:4px;border-top:2px dashed var(--line);padding-top:4px}
.preset[data-preset=bgp].on{background:#FFE9D6;border-color:#FF6A2B;box-shadow:0 4px 0 #FF6A2B}.preset[data-preset=bgp].on::after{color:#FF6A2B}
.preset[data-preset=freeze].on{background:#E2F5FF;border-color:var(--sea2);box-shadow:0 4px 0 var(--sea2)}.preset[data-preset=freeze].on::after{color:var(--sea2)}

View file

@ -61,7 +61,7 @@ button,.chip,.b,a{touch-action:manipulation;-webkit-tap-highlight-color:transpar
.tagline{font-size:13.5px;margin:8px 0 10px}
.slots{max-height:38vh}.slot-go{padding:7px 4px 7px 9px;gap:8px}.slot-go>i{font-size:22px}.slot .sn b{font-size:16px}.slot .sm em{font-size:13.5px}.slot .sn small,.slot .sm small{font-size:11.5px}
.door{padding:7px 9px 6px}.door i{font-size:22px}.door b{font-size:16px}.door span{font-size:11.5px}
.presets{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
.presets{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
.presets .preset{flex-direction:column;align-items:center;text-align:center;padding:6px 4px;gap:0}
.presets .preset i{font-size:20px}.presets .preset b{font-size:13.5px}
.chaos{grid-template-columns:repeat(2,minmax(0,1fr))}
@ -80,7 +80,7 @@ button,.chip,.b,a{touch-action:manipulation;-webkit-tap-highlight-color:transpar
#left.full,#panel.full{width:min(640px,80%) !important}
#tabbar button .ic{font-size:16px}
.doors{grid-template-columns:repeat(4,minmax(0,1fr))}.chaos{grid-template-columns:repeat(4,minmax(0,1fr))}
.presets{grid-template-columns:repeat(3,minmax(0,1fr))}.preset{display:flex}
.presets{grid-template-columns:repeat(4,minmax(0,1fr))}.preset{display:flex}
body.sheet-open #coach{bottom:calc(var(--tabbar) + 8px);left:8px;transform:none;width:calc(42% - 16px)}
}
/* Installed as an app: no browser chrome, so leave room for the notch and the home indicator. */

130
tests/best-effort.test.js Normal file
View file

@ -0,0 +1,130 @@
// Best Effort (☕): the gentlest Normal preset. Change Freeze's quiet (rare outages, no DDoS, no chaos monkey, quick
// builds, no market) plus no cable ships, no conferences, patient customers, a rescue loan instead of game over and
// quiet notifications by default.
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const start = (ev, preset) => ev(`beginGame('Soft Serve','mrs',{mode:'normal',preset:'${preset}'});if(UI.pendGame)ACT.pitchSkip();closeModal();S.cash=1e8;for(const g of GOALS)S.done[g.id]=0`);
const J = (ev, code) => JSON.parse(ev(`JSON.stringify(${code})`));
test('Best Effort is a Normal preset with its own rules, kept through save and load', () => {
const { ev, errors } = load();
start(ev, 'soft');
assert.equal(ev('rulePreset()'), 'soft');
assert.deepEqual(J(ev, "['chaos','lead','market','sea','confs','broke','moods'].map(rule)"), ['calm', 'quick', false, 'timer', false, 'rescue', 'patient']);
assert.equal(ev('ddosOff()'), true, 'no DDoS');
assert.equal(ev('mkElig()'), false, 'no chaos monkey');
ev("S.rules.confs=true;S.rules.sea='ships';const t=JSON.stringify(packSave(S));S=migrate(JSON.parse(t))");
assert.deepEqual(J(ev, "[rulePreset(),rule('confs'),rule('sea')]"), ['soft', false, 'timer'], 'an edited save gets its preset back');
// Every other preset keeps the classic game's ships, conferences, game over and moods.
for (const p of ['freeze', 'oncall', 'bgp']) {
start(ev, p);
assert.deepEqual(J(ev, "['sea','confs','broke','moods'].map(rule)"), ['ships', true, 'lose', 'normal'], p);
}
assert.deepEqual(errors, []);
});
test('Best Effort: a subsea cut mends on its own clock, with no cable ship', () => {
for (const [p, ships] of [['soft', false], ['freeze', true]]) {
const { ev, errors } = load();
start(ev, p);
ev("ACT.buildPop({city:'bcn'});S.links=[{id:'med',a:'bcn',b:'mrs',kind:'wave',sub:true,tier:0,km:365,cable:'medusa',cut:0,mo:1000}];S.inc=[];S.fleet={};compute();fireFailure('cut')");
const i = J(ev, "S.inc.find(i=>i.type==='cut')");
assert.ok(i, p);
assert.equal(i.ship != null || !!i.seaq, ships, `${p}: a ship sails out only with ships`);
assert.equal(Object.keys(J(ev, 'S.fleet')).length > 0, ships, p);
if (!ships) {
assert.ok(i.until > ev('S.day') && i.until - ev('S.day') <= 17, 'mends in 10 to 17 days, like a cut on land');
for (let k = 0; k < 18; k++) ev('dayTick()');
assert.equal(ev("S.inc.some(i=>i.type==='cut')"), false, 'and is mended');
}
assert.deepEqual(errors, [], p);
}
});
test('Best Effort: no conference season', () => {
const { ev, errors } = load();
start(ev, 'soft');
assert.deepEqual(J(ev, 'upcomingConfs(400)'), []);
for (let k = 0; k < 400; k++) ev('S.nextFail=S.nextEvent=1e9;dayTick()');
assert.equal(ev('!!S.conf||!!(S.stats.confs)'), false);
assert.equal(ev('confSection()'), '');
assert.equal(ev("S.log.some(e=>/NANOG|APRICOT|PTC/.test(JSON.stringify(e)))"), false, 'no invitations');
start(ev, 'freeze');
assert.ok(J(ev, 'upcomingConfs(400)').length > 0, 'Change Freeze still has them');
assert.deepEqual(errors, []);
});
test('Best Effort: customers sour half as fast', () => {
const drop = {};
for (const p of ['soft', 'freeze']) {
const { ev, errors } = load();
start(ev, p);
ev("ACT.launchBB({city:'mrs'});ACT.buyTransit({city:'mrs',net:'cog',tier:1});S.biz=[{id:'b',name:'B',type:'dia',city:'mrs',bw:1,rate:100,mood:80,since:0}];S.day=100;compute()");
// Every path down: the customer gets nothing for a day.
ev("S.transit.forEach(t=>t.down=S.day+5);S.nextFail=S.nextEvent=1e9;dayTick()");
drop[p] = 80 - ev("S.biz[0].mood");
assert.deepEqual(errors, [], p);
}
assert.ok(drop.freeze > 0);
assert.ok(Math.abs(drop.soft - drop.freeze / 2) < 1e-9, `half: ${drop.soft} vs ${drop.freeze}`);
});
test('Best Effort: deep in the red, a rescue loan instead of game over', () => {
const { ev, errors } = load();
start(ev, 'soft');
ev("ACT.launchBB({city:'mrs'});compute();S.cash=-250000;S.nextFail=S.nextEvent=1e9;dayTick()");
assert.equal(ev('!!S.lost'), false);
assert.ok(ev('S.cash') > 0, 'back in the black');
const l = J(ev, "S.loans.find(l=>l.bank==='gov')");
assert.ok(l && l.covs.length === 0 && l.term === 60 && l.pay > 0, 'a five-year state loan, no conditions');
assert.match(ev("document.getElementById('toasts').textContent"), /Ministry of Tubes stepped in/);
start(ev, 'freeze');
ev("ACT.launchBB({city:'mrs'});compute();S.cash=-250000;S.nextFail=S.nextEvent=1e9;dayTick()");
assert.equal(ev('!!S.lost'), true, 'the other presets still end the game');
assert.deepEqual(errors, []);
});
test('quiet notifications: on by default in Best Effort, a setting everywhere, and the NOC log keeps everything', () => {
const { ev, dom, errors } = load();
const shown = () => ev("document.getElementById('toasts').textContent");
ev("localStorage.removeItem('sot-prefs');PREFS={}");
start(ev, 'soft');
assert.equal(ev('quietOn()'), true);
ev("document.getElementById('toasts').innerHTML='';UI.tick=true;toast('Quiet news','good');toast('Bad news','bad');toast('A milestone','goal');UI.tick=false");
assert.doesNotMatch(shown(), /Quiet news/, 'good news from the day stays in the log');
assert.match(shown(), /Bad news/);
assert.match(shown(), /A milestone/);
assert.equal(ev("S.log.some(e=>/Quiet news/.test(JSON.stringify(e)))"), true, 'the NOC log has it');
ev("toast('You clicked','good')");
assert.match(shown(), /You clicked/, 'what a click says still shows');
start(ev, 'oncall');
assert.equal(ev('quietOn()'), false, 'off elsewhere by default');
// The setting, at 360 px.
dom.window.innerWidth = 360;
ev('UI.setOpen=true;openModal(settingsHtml())');
const doc = dom.window.document;
assert.match(doc.getElementById('modalCard').textContent, /Quiet notifications/);
doc.querySelector('#modalCard [data-act="prefSet"][data-args*="quiet:1"]').click();
assert.equal(ev('quietOn()'), true, 'chosen on, on in every mode');
start(ev, 'soft');
ev("ACT.prefSet({v:'quiet:0'})");
assert.equal(ev('quietOn()'), false, 'chosen off, off even in Best Effort');
assert.deepEqual(errors, []);
});
test('the title screen offers Best Effort first, and it earns Freeze-dried badges', () => {
const { ev, dom, errors } = load();
const doc = dom.window.document;
ev('window.innerWidth=360;showTitle()');
const ps = [...doc.querySelectorAll('#modal .preset')].map((b) => b.dataset.preset);
assert.deepEqual(ps, ['soft', 'freeze', 'oncall', 'bgp']);
doc.querySelector('.preset[data-preset=soft]').click();
assert.match(doc.getElementById('presetWhat').textContent, /No SLA, no pager/);
ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip()");
assert.equal(ev('rulePreset()'), 'soft');
assert.match(ev("document.getElementById('hAsn').textContent"), /Best Effort/);
assert.equal(ev('badgeVar()'), 'freeze');
assert.deepEqual(errors, []);
});

View file

@ -206,33 +206,38 @@ test('N7: presence is real: PoPs are cities, exchange ports only where the netwo
// ---------- Modes and rules ----------
test('M1: On-call is the classic game: the default rules, and what old saves load as', () => {
assert.deepEqual(J("(({preset,mods,...r})=>r)(makeRules('oncall'))"), J("(({mods,...r})=>r)(RULE_DEF)"), 'M1: On-call is RULE_DEF');
assert.deepEqual(J("(({preset,mods,...r})=>r)(makeRules('oncall'))"), J("(({mods,...r})=>{for(const k of RULE_LATE)delete r[k];return r;})(RULE_DEF)"), 'M1: On-call is RULE_DEF');
assert.deepEqual(J("(()=>{const o=S.rules;S.rules=makeRules('oncall');const v=Object.keys(RULE_OK).map(rule);S.rules=o;return v;})()"), J("Object.keys(RULE_OK).map(k=>RULE_DEF[k])"), 'M1: and plays as RULE_DEF');
assert.equal(ev("(()=>{const o=S.rules;delete S.rules;const p=rulePreset();S.rules=o;return p;})()"), 'oncall', 'M1: no rules means On-call');
// the seeded On-call games are the rest of the suite (tests/game.test.js, tests/rules.test.js); they must stay green
});
test('M2: presets are ordered: Change Freeze never harsher than On-call, BGP at 3 a.m. never gentler', () => {
const P = J('PRESETS'), C = J('CHAOS'), lead = { quick: 0, real: 1 };
assert.ok(C[P.freeze.chaos].m <= C[P.oncall.chaos].m && C[P.oncall.chaos].m <= C[P.bgp.chaos].m, 'M2: chaos');
assert.ok(lead[P.freeze.lead] <= lead[P.oncall.lead] && lead[P.oncall.lead] <= lead[P.bgp.lead], 'M2: lead times');
assert.ok(!P.freeze.market || P.oncall.market, 'M2: market');
test('M2: presets are ordered: Best Effort never harsher than Change Freeze, Change Freeze never harsher than On-call, BGP at 3 a.m. never gentler', () => {
const P = J('PRESETS'), C = J('CHAOS'), D = J('RULE_DEF'), lead = { quick: 0, real: 1 }, v = (p, k) => P[p][k] !== undefined ? P[p][k] : D[k];
assert.ok(C[P.soft.chaos].m <= C[P.freeze.chaos].m && C[P.freeze.chaos].m <= C[P.oncall.chaos].m && C[P.oncall.chaos].m <= C[P.bgp.chaos].m, 'M2: chaos');
assert.ok(lead[P.soft.lead] <= lead[P.freeze.lead] && lead[P.freeze.lead] <= lead[P.oncall.lead] && lead[P.oncall.lead] <= lead[P.bgp.lead], 'M2: lead times');
assert.ok((!P.soft.market || P.freeze.market) && (!P.freeze.market || P.oncall.market), 'M2: market');
// The softenings only Best Effort has: every other Normal preset keeps the classic game's.
for (const k of ['sea', 'confs', 'broke', 'moods']) for (const p of ['freeze', 'oncall', 'bgp']) assert.equal(v(p, k), D[k], `M2: ${p} keeps ${k}`);
assert.deepEqual(['sea', 'confs', 'broke', 'moods'].map((k) => v('soft', k)), ['timer', false, 'rescue', 'patient'], 'M2: Best Effort softens them all');
assert.ok(P.bgp.market && P.bgp.money === 'normal' && P.bgp.gates === 'ladder', 'M2: BGP keeps every hardship');
// seeded: the same network for a year under each preset
const n = {};
for (const p of ['freeze', 'oncall', 'bgp']) {
for (const p of ['soft', 'freeze', 'oncall', 'bgp']) {
const g = load();
g.ev(`beginGame('Order','fra',${JSON.stringify({ mode: 'normal', preset: p })});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});__reseed(4242);for(let i=0;i<360;i++)dayTick()`);
n[p] = g.ev('S.inc.length+S.stats.survived+(S.stats.incidents||0)');
assert.deepEqual(g.errors, []);
}
assert.ok(n.freeze <= n.oncall && n.oncall <= n.bgp, `M2: incidents in a year: freeze ${n.freeze}, on-call ${n.oncall}, bgp ${n.bgp}`);
assert.ok(n.soft <= n.freeze && n.freeze <= n.oncall && n.oncall <= n.bgp, `M2: incidents in a year: soft ${n.soft}, freeze ${n.freeze}, on-call ${n.oncall}, bgp ${n.bgp}`);
});
test('M3: every subsystem that can annoy the player reads a rule', () => {
// [function, what it must read]
const reads = [['dayPost', 'chaosMul()'], ['fireEvent', "rule('market')"], ['ddosTick', 'ddosOff()'],
['soldOut', "rule('market')"], ['hwMul', "rule('market')"], ['leadDays', "rule('lead')"], ['pniLead', 'leadDays'],
['dfBuildDays', 'leadDays'], ['dayPre', "rule('clock')"], ['snub', "rule('market')"]];
['dfBuildDays', 'leadDays'], ['dayPre', "rule('clock')"], ['snub', "rule('market')"], ['fireFailure', 'shipsOn()'],
['upcomingConfs', 'confsOn()'], ['dayPost', "rule('broke')"], ['dayPost', "rule('moods')"], ['toast', 'quietOn()']];
fail('M3', reads.filter(([f, r]) => !ev(`typeof ${f}==='function'&&${f}.toString().includes(${JSON.stringify(r)})`)).map(([f, r]) => `${f}() does not read ${r}`), 'gate it on the ruleset (src/game/40-progress/30-rules.js)');
// and in play: no chaos and no market means a quiet year
const g = load();

View file

@ -45,12 +45,12 @@ test('rules survive save and load, and junk is repaired', () => {
assert.deepEqual(errors, []);
});
test('the title screen: four doors, three Normal presets, a chaos picker for Sandbox, at 360 px', () => {
test('the title screen: four doors, four Normal presets, a chaos picker for Sandbox, at 360 px', () => {
const { ev, dom, errors } = load();
const doc = dom.window.document;
ev('window.innerWidth=360;showTitle()');
assert.equal(doc.querySelectorAll('#modal .door').length, 4);
assert.equal(doc.querySelectorAll('#modal .preset').length, 3);
assert.equal(doc.querySelectorAll('#modal .preset').length, 4);
assert.equal(doc.querySelectorAll('#modal .chs').length, 4);
assert.equal(doc.getElementById('doorSandbox').hidden, true);
assert.ok(doc.querySelector('.preset[data-preset=oncall].on'), 'On-call is the default');