From e17ddc247bff6ee82e8d50e4bb3734a57fff28ae Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Thu, 29 Oct 2026 09:55:35 +0100 Subject: [PATCH] Change Freeze stops de-peering at exchanges Snubs (refused and torn-down sessions at exchanges) are part of the market rule now, so Change Freeze and puzzles have none; On-call is unchanged. --- .claude/skills/gameplay-rules/SKILL.md | 2 +- CHANGELOG.md | 2 +- site/i18n/de.js | 2 +- site/i18n/es.js | 2 +- site/i18n/fr.js | 2 +- site/i18n/it.js | 2 +- site/i18n/pt.js | 2 +- src/game/40-progress/30-rules.js | 2 +- src/game/70-rules/50-peering-policy.js | 5 +++-- src/i18n/en.js | 2 +- tests/gameplay-rules.test.js | 6 ++---- tests/peering.test.js | 20 ++++++++++++++++++++ 12 files changed, 34 insertions(+), 15 deletions(-) diff --git a/.claude/skills/gameplay-rules/SKILL.md b/.claude/skills/gameplay-rules/SKILL.md index 98de506..092aa0f 100644 --- a/.claude/skills/gameplay-rules/SKILL.md +++ b/.claude/skills/gameplay-rules/SKILL.md @@ -44,7 +44,7 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one | --- | --- | --- | | 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, inbox; 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, the peering inbox, sold-out routes and hardware prices (`market`), lead times (`lead`), the clock. A quiet ruleset gives a quiet year. | Rules are presets of flags, not separate code. Open question: de-peering ignores the rules (exception). | +| M3 | Every subsystem that can annoy the player reads a rule: outages and events (`chaos`), DDoS, the peering inbox, 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. | | 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. | diff --git a/CHANGELOG.md b/CHANGELOG.md index 4933538..f681b9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ All notable changes to this project are documented here. The project follows - A new weekly puzzle every Sunday morning, the same for everyone: a themed puzzle such as an ocean crossing, a ring, a latency sprint, island hopping or a detour around a busy hub, with its own name and a budget tuned so three stars take a smart design. The Puzzles door says "New this Sunday!" until you have played it, the list counts down to the next one, and your streak and share line use the week's name. A new puzzle week starts on Sunday at 06:00 Berlin time; offline, the game still has a weekly puzzle of its own. - Hire a NOC intern and give them standing orders: from customer level 2, Kevin from the night shift, Anycast Annie or Tracy Route runs your rules once a game day and pays exactly what your own clicks would. Keep transit above a multiple of its peak, add or swap routers above a load, take free caches, peer at every IX and PNI with the big networks every week, sign ready customers and decline tiny ones, rush repairs, light more fiber and retire small parallel waves. Each order has a pause switch, its own settings, a monthly budget and per-POP exceptions, never breaks a customer's or a bank's transit requirement, and shows what it adds to your monthly bill. The Ops sheet opens with the intern's mood and a weekly shift report, which is also the one notice a week the intern leaves in the NOC (#98, #100, #102, #181, #185, #192, #177). - Tier 1 now works like the real thing: peer with the Tier 1 club and their customers come along for free (#85). A PNI or an exchange session reaches the networks you peer with and everyone who buys transit from them, so you no longer chase every tiny ISP for the win; only networks that buy transit from nobody, like the content giants and the big incumbents, still need peering of their own. Small networks and more real eyeball ISPs now buy transit from real-world upstreams, a peer's customers are tried after your direct peers and before transit (so peering widely still pays), the traceroute shows the hand-off, and the Road to Tier 1 card counts who already comes along. Games already won stay won. -- 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. +- 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, sold-out routes and de-peering at exchanges. 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. - Keep several networks on one device, and play two of them side by side in two browser windows. The title screen lists your networks, newest first, with their day, tier, cash and when you last played; tap one to continue it, or use ⋯ to export or delete it. Starting a scenario, the weekly challenge or a new network, or importing a save, now adds a network instead of replacing the one you have, and you can rename a network from the menu. Each window remembers its own network when you reload it. If a network is already open in another window, you can switch to it or take it over, and the other window steps aside instead of both saving over each other. Your existing save carries on as your first network. - Badges now come in variants: games under the Change Freeze rules earn frosted Freeze-dried badges, and games under BGP at 3 a.m. earn fiery ones worth bragging about. Earning a badge under harder rules than before upgrades it in your collection on this device, and the badge list counts how many of each kind you have. On-call games earn the standard badges; Sandbox and puzzles earn none. diff --git a/site/i18n/de.js b/site/i18n/de.js index 711b9e0..bd56b10 100644 --- a/site/i18n/de.js +++ b/site/i18n/de.js @@ -3243,6 +3243,7 @@ "routing_and_routers.unplug_something_first_used_ports":"Steck zuerst etwas aus.
{used} Ports sind belegt, und mit einem Router weniger gibt es nur {max}.", "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":"Ein Drittel der Ausfälle, kein DDoS. PNIs und Bauten in Tagen. Kein Postfach, keine Lieferengpässe, keine ausverkauften Routen, kein De-Peering.", "rules.bgp_at_3_a_m":"BGP um 3 Uhr nachts", "rules.change_freeze":"Change Freeze", "rules.chaos_calm":"Ruhig", @@ -3250,7 +3251,6 @@ "rules.chaos_normal":"Normal", "rules.chaos_spicy":"Scharf", "rules.everything_is_on_fire_and_it":"Alles brennt, und du hast Bereitschaft.", -"rules.fewer_outages_pnis_and_builds_in":"Ein Drittel der Ausfälle, kein DDoS. PNIs und Bauten in Tagen. Kein Postfach, keine Lieferengpässe, keine ausverkauften Routen.", "rules.infinite_money_everything_unlocked_quick":"Endlos Geld, alles freigeschaltet, kurze Lieferzeiten. Keine Abzeichen.", "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.", diff --git a/site/i18n/es.js b/site/i18n/es.js index 21a7058..3f3a819 100644 --- a/site/i18n/es.js +++ b/site/i18n/es.js @@ -3241,6 +3241,7 @@ "routing_and_routers.unplug_something_first_used_ports":"Desconecta algo primero.
Hay {used} puertos en uso, y con un router menos solo hay {max}.", "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":"Un tercio de las caídas, sin DDoS. PNI y obras en días. Sin bandeja de entrada, sin escasez, sin rutas agotadas, sin de-peering.", "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", @@ -3248,7 +3249,6 @@ "rules.chaos_normal":"Normal", "rules.chaos_spicy":"Picante", "rules.everything_is_on_fire_and_it":"Todo está ardiendo, y te toca a ti.", -"rules.fewer_outages_pnis_and_builds_in":"Un tercio de las caídas, sin DDoS. PNI y obras en días. Sin bandeja de entrada, sin escasez, sin rutas agotadas.", "rules.infinite_money_everything_unlocked_quick":"Dinero sin fin, todo desbloqueado, plazos cortos. Sin insignias.", "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.", diff --git a/site/i18n/fr.js b/site/i18n/fr.js index ec80dc5..acdf746 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -3241,6 +3241,7 @@ "routing_and_routers.unplug_something_first_used_ports":"Débranche d’abord quelque chose.
{used} ports sont utilisés, et avec un routeur de moins tu n’en aurais que {max}.", "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":"Un tiers des pannes, pas de DDoS. PNI et chantiers en quelques jours. Pas de boîte de réception, pas de pénurie, pas de routes épuisées, pas de dépeering.", "rules.bgp_at_3_a_m":"BGP à 3 h du matin", "rules.change_freeze":"Gel des changements", "rules.chaos_calm":"Calme", @@ -3248,7 +3249,6 @@ "rules.chaos_normal":"Normal", "rules.chaos_spicy":"Épicé", "rules.everything_is_on_fire_and_it":"Tout brûle, et c’est ton tour d’astreinte.", -"rules.fewer_outages_pnis_and_builds_in":"Un tiers des pannes, pas de DDoS. PNI et chantiers en quelques jours. Pas de boîte de réception, pas de pénurie, pas de routes épuisées.", "rules.infinite_money_everything_unlocked_quick":"Argent infini, tout débloqué, délais courts. Pas de badges.", "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é.", diff --git a/site/i18n/it.js b/site/i18n/it.js index f6250c9..f959550 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -3241,6 +3241,7 @@ "routing_and_routers.unplug_something_first_used_ports":"Prima stacca qualcosa.
Ci sono {used} porte in uso, e con un router in meno ne avresti solo {max}.", "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":"Un terzo dei guasti, niente DDoS. PNI e cantieri in pochi giorni. Niente posta, niente carenze, niente rotte esaurite, niente de-peering.", "rules.bgp_at_3_a_m":"BGP alle 3 di notte", "rules.change_freeze":"Change freeze", "rules.chaos_calm":"Calmo", @@ -3248,7 +3249,6 @@ "rules.chaos_normal":"Normale", "rules.chaos_spicy":"Piccante", "rules.everything_is_on_fire_and_it":"Va tutto a fuoco, e tocca a te.", -"rules.fewer_outages_pnis_and_builds_in":"Un terzo dei guasti, niente DDoS. PNI e cantieri in pochi giorni. Niente posta, niente carenze, niente rotte esaurite.", "rules.infinite_money_everything_unlocked_quick":"Soldi infiniti, tutto sbloccato, consegne rapide. Niente medaglie.", "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.", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index 4308d56..1f7e31c 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -3241,6 +3241,7 @@ "routing_and_routers.unplug_something_first_used_ports":"Desconecte algo primeiro.
Há {used} portas em uso, e com um router a menos só teria {max}.", "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":"Um terço das falhas, sem DDoS. PNIs e obras em dias. Sem caixa de entrada, sem escassez, sem rotas esgotadas, sem de-peering.", "rules.bgp_at_3_a_m":"BGP às 3 da manhã", "rules.change_freeze":"Congelamento de mudanças", "rules.chaos_calm":"Calmo", @@ -3248,7 +3249,6 @@ "rules.chaos_normal":"Normal", "rules.chaos_spicy":"Apimentado", "rules.everything_is_on_fire_and_it":"Está tudo pegando fogo, e o plantão é seu.", -"rules.fewer_outages_pnis_and_builds_in":"Um terço das falhas, sem DDoS. PNIs e obras em dias. Sem caixa de entrada, sem escassez, sem rotas esgotadas.", "rules.infinite_money_everything_unlocked_quick":"Dinheiro sem fim, tudo desbloqueado, prazos curtos. Sem medalhas.", "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.", diff --git a/src/game/40-progress/30-rules.js b/src/game/40-progress/30-rules.js index c61421b..656677e 100644 --- a/src/game/40-progress/30-rules.js +++ b/src/game/40-progress/30-rules.js @@ -7,7 +7,7 @@ const RULE_DEF={clock:true,chaos:'normal',lead:'real',market:true,inbox:true,mon const RULE_OK={clock:[true,false],chaos:['none','calm','normal','spicy'],lead:['real','quick'],market:[true,false],inbox:[true,false],money:['normal','infinite'],gates:['ladder','open']}; // i: icon, n: name, d: the one-line joke, x: what is different, in small print. const PRESETS={ - freeze:{i:'🧊',n:tr('rules.change_freeze'),d:tr('rules.nobody_touches_prod_even_the_backhoes'),x:tr('rules.fewer_outages_pnis_and_builds_in'),clock:true,chaos:'calm',lead:'quick',market:false,inbox:false,money:'normal',gates:'ladder'}, + 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'),clock:true,chaos:'calm',lead:'quick',market:false,inbox: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'),clock:true,chaos:'normal',lead:'real',market:true,inbox: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,inbox: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,inbox:true,money:'infinite',gates:'open'}, diff --git a/src/game/70-rules/50-peering-policy.js b/src/game/70-rules/50-peering-policy.js index 48edcd3..93e1913 100644 --- a/src/game/70-rules/50-peering-policy.js +++ b/src/game/70-rules/50-peering-policy.js @@ -1,12 +1,13 @@ /* Big networks sometimes refuse to peer in a particular city, for a while. Each (network, city) - pair gets a stable verdict per window, derived from a hash, so asking again does not reroll it. */ + pair gets a stable verdict per window, derived from a hash, so asking again does not reroll it. + It is part of the market: without one (Change Freeze, puzzles), nobody refuses or drops a session. */ const SNUB_WIN=150,SNUB_P=0.22; const SNUB_IX=[tr('peering_policy.only_peers_over_pnis_in_this'),tr('peering_policy.their_ix_port_here_is_full'),tr('peering_policy.moved_everything_in_this_city_to'),tr('peering_policy.the_peering_coordinator_for_this'),tr('peering_policy.their_policy_here_says_ix_peering')]; const SNUB_ALL=[tr('peering_policy.not_accepting_new_peers_in_this'),tr('peering_policy.region_frozen_while_they_renegotiate'),tr('peering_policy.their_routers_in_this_city_are'),tr('peering_policy.already_reach_you_through_your'),tr('peering_policy.their_lawyers_are_reviewing_every'),tr('peering_policy.a_new_vp_wants_to_monetise')]; function hstr(t){let h=2166136261;for(let i=0;i>>0;} function bigPeer(n){return !!n&&n.pol==='selective'&&n.share>=0.03;} function snub(id,c){ - const n=NET[id];if(!c||!bigPeer(n)||!S||S.myIx[c])return null; + const n=NET[id];if(!c||!bigPeer(n)||!S||S.myIx[c]||!rule('market'))return null; const off=hstr(id+c)%SNUB_WIN,ep=Math.floor((S.day+off)/SNUB_WIN),h=hstr(S.asn+'|'+id+'|'+c+'|'+ep); if(h%1000>=SNUB_P*1000)return null; const all=(h>>>10)%5<2,list=all?SNUB_ALL:SNUB_IX; diff --git a/src/i18n/en.js b/src/i18n/en.js index c8236d6..193d061 100644 --- a/src/i18n/en.js +++ b/src/i18n/en.js @@ -3242,6 +3242,7 @@ "routing_and_routers.unplug_something_first_used_ports":"Unplug something first.
{used} ports are in use, and one router fewer only has {max}.", "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":"A third of the outages, no DDoS. PNIs and builds in days. No inbox, no shortages, no sold-out routes, no de-peering.", "rules.bgp_at_3_a_m":"BGP at 3 a.m.", "rules.change_freeze":"Change Freeze", "rules.chaos_calm":"Calm", @@ -3249,7 +3250,6 @@ "rules.chaos_normal":"Normal", "rules.chaos_spicy":"Spicy", "rules.everything_is_on_fire_and_it":"Everything is on fire, and it's your turn.", -"rules.fewer_outages_pnis_and_builds_in":"A third of the outages, no DDoS. PNIs and builds in days. No inbox, no shortages, no sold-out routes.", "rules.infinite_money_everything_unlocked_quick":"Endless money, everything unlocked, quick lead times. No badges.", "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.", diff --git a/tests/gameplay-rules.test.js b/tests/gameplay-rules.test.js index 3535fb8..3c2c1f7 100644 --- a/tests/gameplay-rules.test.js +++ b/tests/gameplay-rules.test.js @@ -84,9 +84,7 @@ const EXCEPTIONS = { 'spl:hba': 'Speedyloop reaches Hobart’s exchange over its own backhaul but sells no transit there', }, // M3: subsystems that annoy the player but read no rule. - M3: { - snub: 'de-peering at exchanges happens in every mode (open question: should Change Freeze stop it?)', - }, + M3: {}, }; // The real names the puns are based on. No network, cable, exchange, data center, router or optic may be called one. @@ -234,7 +232,7 @@ test('M3: every subsystem that can annoy the player reads a rule', () => { // [function, what it must read] const reads = [['dayTick', 'chaosMul()'], ['fireEvent', "rule('market')"], ['ddosTick', 'ddosOff()'], ['inboxDay', "rule('inbox')"], ['soldOut', "rule('market')"], ['hwMul', "rule('market')"], ['leadDays', "rule('lead')"], ['pniLead', 'leadDays'], - ['dfBuildDays', 'leadDays'], ['dayTick', "rule('clock')"]]; + ['dfBuildDays', 'leadDays'], ['dayTick', "rule('clock')"], ['snub', "rule('market')"]]; 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, no market, no inbox means a quiet year const g = load(); diff --git a/tests/peering.test.js b/tests/peering.test.js index 4b51227..4e1d185 100644 --- a/tests/peering.test.js +++ b/tests/peering.test.js @@ -99,6 +99,26 @@ test('a snubbing peer tears down an existing session and the Request button expl assert.deepEqual(errors, []); }); +test('Change Freeze never refuses or tears down a session at an exchange; On-call does', () => { + const { ev, errors } = load(); + setup(ev); + const k = ev(`(()=>{const ok=['fra','ams','lon','par','nyc','ash','sjc','sin','tok','hkg']; + for(let d=0;d<600;d++)for(const n of NETS)for(const c of ok){if(!ixMembers(c).includes(n.id))continue; + S.day=d;const a=snub(n.id,c);S.day=d+1;const b=snub(n.id,c);S.day=0;if(!a&&b)return n.id+'@'+c+'@'+d;}})()`); + assert.ok(k, 'found a snub starting at an IX'); + const [id, c, d] = k.split('@'); + ev(`S.rules=makeRules('freeze');S.day=${d}`); + ev(`ACT.buildPop({city:'${c}'});ACT.buyIx({city:'${c}',tier:1,signed:true});S.peers['${id}@${c}']=true;compute()`); + ev('dayTick()'); + assert.equal(ev(`!!S.peers['${id}@${c}']`), true, 'the session survives the freeze'); + assert.equal(ev(`snub('${id}','${c}')`), null, 'and nobody refuses a new one'); + assert.equal(ev(`ixSessions('${c}').has('${id}')`), true); + assert.equal(ev('S.stats.depeered||0'), 0); + ev(`S.rules=makeRules('oncall');S.day=${+d + 1}`); + assert.ok(ev(`!!snub('${id}','${c}')`), 'On-call still snubs the same pair'); + assert.deepEqual(errors, []); +}); + test('remote peering is offered but costs more, gives less and gets refused more', () => { const { ev, errors } = load(); setup(ev);