From fda5607238ca493bd76f2bfb3de3b5d403d50acb Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sun, 1 Nov 2026 12:23:30 +0000 Subject: [PATCH] Doitsche Telekomm and Tangerine Telecom are Tier 1s (#194) Both are typed t1 and count for the Tier 1 goal in new games only (t1v 4); older saves keep the Tier 1s they were playing for. Doitsche sells transit at 12/Gbps, the dearest in Europe outside the China crossing, and keeps its paid peering and 1G PNIs. Tangerine keeps its selective policy, sells at 6, and gains a Frankfurt PoP like every other Tier 1. W2 now counts Tier 1 incumbents with home markets; the N3 exceptions for both are gone, since Tier 1s are not checked there. --- .claude/skills/gameplay-rules/SKILL.md | 2 +- CHANGELOG.md | 1 + src/game/30-networks/10-networks.js | 4 +- src/game/60-features/80-new-game.js | 2 +- src/game/70-rules/30-pnis.js | 2 +- src/game/70-rules/80-hot-ports-and-rank.js | 5 +- src/game/93-ui/70-link-panels.js | 2 +- tests/gameplay-rules.test.js | 6 +- tests/issues.test.js | 4 +- tests/regions.test.js | 4 +- tests/tier1-cone.test.js | 9 +-- tests/tier1-incumbents.test.js | 66 ++++++++++++++++++++++ 12 files changed, 88 insertions(+), 19 deletions(-) create mode 100644 tests/tier1-incumbents.test.js diff --git a/.claude/skills/gameplay-rules/SKILL.md b/.claude/skills/gameplay-rules/SKILL.md index abf9a0f..1a7f1d3 100644 --- a/.claude/skills/gameplay-rules/SKILL.md +++ b/.claude/skills/gameplay-rules/SKILL.md @@ -21,7 +21,7 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one | Id | Rule | Why | | --- | --- | --- | | W1 | Every city has a country code (`cc`, ISO 3166-1 alpha-2; territories have their own: PR, GU, RE, MQ, CW…), a region, a landmass and coordinates. | Borders, prices and the eyeball rule all hang off the country. | -| W2 | Every country on the map has at least two consumer networks of its own: an eyeball network, or a Tier 2 incumbent that sells to homes, whose home markets (`cc` on the network) include that country and which has a PoP there. | Real countries have competing local ISPs, and peering locally is half the game. Add real operators in `src/game/30-networks/32-homegrown-eyeballs.js`. | +| W2 | Every country on the map has at least two consumer networks of its own: an eyeball network, or a Tier 1 or Tier 2 incumbent that sells to homes, whose home markets (`cc` on the network) include that country and which has a PoP there. | Real countries have competing local ISPs, and peering locally is half the game. Add real operators in `src/game/30-networks/32-homegrown-eyeballs.js`. | | W3 | Every city can buy transit from someone, or is a documented exception (Pitcairn: land your own cable; Stuttgart: peering only). | A start or an expansion must never be a dead end by accident. | | W4 | Cable pairs join two distinct real cities, have a length, and cable ids are unique. | Broken landings break routing and the own-cable planner. | | W5 | A city alone on its landmass has a cable or a beach to land one. | Islands are reachable. | diff --git a/CHANGELOG.md b/CHANGELOG.md index 0c39909..6cc297c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project are documented here. The project follows - When every ship of a region's club is out, a subsea cut waits for the first one back. A private charter of the quickest free ship anywhere jumps the queue for $1M plus $200 per km it sails; the NOC intern's rush-repair order can pay it within its budget. - Building your own subsea cable now shows the survey, permits and cable factory first, then a lay ship laying about 150 km a day. Crews can no longer speed up a cable at sea: book a second lay ship before laying starts instead, for $3M plus $150k a day, and it lays from the other end to halve that part. - Tap a cable ship on the map to see its name, its club and what it is doing. +- Doitsche Telekomm and Tangerine Telecom are now Tier 1s, as in real life (#194). In new games, going transit-free means a PNI with both of them too; games you already started keep the Tier 1s they were playing for. Doitsche now sells transit at the highest price in Europe and still charges for peering, and like the other Tier 1s, Tangerine now starts its PNIs at 100G. ## [2.3.0] — 2026-10-31 diff --git a/src/game/30-networks/10-networks.js b/src/game/30-networks/10-networks.js index de4ad23..bf6682d 100644 --- a/src/game/30-networks/10-networks.js +++ b/src/game/30-networks/10-networks.js @@ -6,14 +6,14 @@ const NETS=[ {id:'cog',name:'Cogentle',asn:714,type:'t1',pol:'restrictive',share:.04,price:3,col:'#B35CF0',pops:['hfx','bde','man','edi','bcn','mil','rom','lis','ath','atn','den','phx','bos','hou','slc','ber','zrh','dub','hel','sof','beg','tor','lax','mex','cph','icn','sea','sjc','dal','chi','ash','nyc','mia','sao','lon','ams','fra','par','mad','mrs','sto','sin','hkg','tok','rio','bue','scl','bog','lim','osa','waw','prg','vie','bud','buh','ist','kyv','kcy','van','ott','bru','oos','bet','ham','muc','dus','syd','per'],ix:[],blurb:tr('networks.cheapest_transit_on_the_map_famously')}, {id:'tat',name:'Ta-Ta Comms',asn:6543,type:'t1',pol:'restrictive',share:.04,price:9,col:'#6A4C93',pops:['tci','gum','mil','pmo','lis','nbo','cai','jkt','dxb','nyc','ash','lon','fra','mrs','lag','jnb','bom','sin','hkg','tok','del','maa','blr','hyd','cpt','fuj','auh','tpe','khi','dac','cbo','kul','bkk','jed','ruh','doh','jib','dar','mba','dkr'],ix:[],blurb:tr('networks.waves_goodbye_to_latency_across_the')}, {id:'drz',name:'Drizzle Electric',asn:9369,type:'t2',pol:'open',share:.04,price:4,col:'#1E90FF',auIx:['syd','mel','bne','per'],pops:['man','chc','edi','svg','bde','bcn','mil','rom','pmo','lis','ath','atn','den','phx','bos','hou','slc','ber','zrh','nbo','akl','per','jkt','mnl','dub','rek','tor','mtl','lax','mex','sof','osl','icn','sea','sjc','dal','chi','ash','nyc','mia','lon','ams','fra','par','sto','mad','hkg','sin','tok','syd','jnb','for','rio','bue','scl','lim','bog','pan','del','maa','blr','hyd','tpe','auh','cpt','mel','bne','osa','kul','bkk','sgn','khi','dac','cbo','waw','prg','vie','bud','buh','tll','ist','kyv','jed','ruh','doh','kcy','cal','van','ott','bru','oos','bet','ham','muc','ccs','lpb','alg','tun','cas','dkr','dus'],ix:'ALL',blurb:tr('networks.will_peer_with_anyone_anywhere')}, - {id:'tng',name:'Tangerine Telecom',asn:5115,type:'t2',cc:['CD','CI','CM','EG','ES','FR','MA','MG','MQ','PL','RE','RO','SN','TN'],pol:'selective',minIx:15,minPni:40,share:.03,price:6,col:'#FF8C42',pops:['tci','bcn','cai','nbo','dxb','par','mrs','mad','lon','ams','lag','jnb','waw','buh','dkr','abj','cas','tun','dla','fih','fdf','run','tnr'],ix:['bcn','par','mrs','mad','lon','ams','lag','jnb','waw','dkr','abj','cas','tun','dla','fih'],blurb:tr('networks.juicy_reach_into_europe_and_africa')}, + {id:'tng',name:'Tangerine Telecom',asn:5115,type:'t1',cc:['CD','CI','CM','EG','ES','FR','MA','MG','MQ','PL','RE','RO','SN','TN'],pol:'selective',minIx:15,minPni:40,share:.03,price:6,col:'#FF8C42',pops:['tci','bcn','cai','nbo','dxb','fra','par','mrs','mad','lon','ams','lag','jnb','waw','buh','dkr','abj','cas','tun','dla','fih','fdf','run','tnr'],ix:['bcn','par','mrs','mad','lon','ams','lag','jnb','waw','dkr','abj','cas','tun','dla','fih'],blurb:tr('networks.juicy_reach_into_europe_and_africa')}, {id:'sgt',name:'SingTell',asn:7474,type:'t2',cc:'SG',pol:'selective',minIx:15,minPni:40,share:.03,price:7,col:'#00A6A6',pops:['jkt','mnl','per','akl','icn','sin','hkg','tok','syd','bom','tpe','maa','kul','bkk','sgn','mel','bne'],ix:['sin','hkg','tok','bom','tpe','maa','kul','bkk'],blurb:tr('networks.sings_your_packets_across_asia')}, {id:'vdp',name:'Voda-Phony',asn:1373,type:'t2',cc:['CD','CZ','DE','EG','ES','GB','GR','IE','MZ','NL','PT','QA','RO','TR','TZ','ZA'],pol:'paid',freeLv:7,paidFee:8000,share:.03,price:6,col:'#E63946',pops:['man','edi','mil','rom','lis','ath','nbo','cai','ber','dub','dxb','lon','fra','ams','mad','mrs','jnb','bom','lag','cpt','del','maa','ist','prg','bud','buh','doh','acc','dar','fih','mpm','dus'],ix:[],blurb:tr('networks.ended_free_peering_across_europe_and')}, {id:'ctc',name:'China Telecomet',asn:4314,type:'t2',cc:'CN',pol:'restrictive',share:.02,price:22,premium:2.5,premAt:['hkg','mos'],premOnly:['mos'],cn:true,col:'#0B5CAD',pops:['pek','sha','hkg','sin','tok','lon','fra','nyc','sjc'],ix:[],blurb:tr('networks.the_biggest_network_in_china_its')}, {id:'cun',name:'China Unicorn',asn:4837,type:'t2',cc:'CN',pol:'restrictive',share:.015,price:16,cn:true,col:'#D7000F',pops:['pek','sha','hkg','fra','sjc','lon'],ix:[],blurb:tr('networks.number_two_in_china_with_a')}, {id:'cmb',name:'China Moble',asn:9880,type:'eye',cc:'CN',pol:'paid',freeLv:10,paidFee:12000,share:.01,cn:true,col:'#0085CA',pops:['pek','sha','hkg'],ix:[],blurb:tr('networks.the_largest_mobile_network_on_earth')}, {id:'cmc',name:'Comecast',asn:7227,type:'eye',cc:'US',pol:'selective',minIx:10,minPni:30,share:.03,col:'#2C7A7B',pops:['atn','den','bos','hou','phx','slc','ash','nyc','chi','sjc','sea','mia'],ix:['atn','den','bos','ash','nyc','chi','sjc','sea'],blurb:tr('networks.huge_eyeball_network_come_for_the')}, - {id:'dtk',name:'Doitsche Telekomm',asn:3203,type:'eye',cc:'DE',pol:'paid',freeLv:6,paidFee:9000,share:.03,col:'#E20074',pops:['fra','ams','lon','ham','muc','dus'],ix:[],blurb:tr('networks.pink_eyeball_giant_peering_is')}, + {id:'dtk',name:'Doitsche Telekomm',asn:3203,type:'t1',cc:'DE',pol:'paid',freeLv:6,paidFee:9000,share:.03,price:12,col:'#E20074',pops:['fra','ams','lon','ham','muc','dus'],ix:[],blurb:tr('networks.pink_eyeball_giant_peering_is')}, {id:'nfx',name:'NetChill',asn:2906,type:'cdn',pol:'selective',minIx:5,minPni:30,share:.15,cache:{name:'Open Couch',min:12},col:'#C8102E',auIx:['syd','mel'],pops:ALLC,ix:'ALL',blurb:tr('networks.streams_40_of_evening_traffic_hands')}, {id:'ggl',name:'Goggle',asn:15961,type:'cdn',pol:'selective',minIx:5,minPni:30,share:.13,cache:{name:'Goggle Global Cache',min:15},col:'#3A7BEA',auIx:['syd','mel'],pops:ALLC,ix:'ALL',blurb:tr('networks.search_video_and_goggles_mostly')}, {id:'fbk',name:'Faceplant',asn:32943,type:'cdn',pol:'selective',minIx:5,minPni:25,share:.08,cache:{name:'Faceplant Node Thingy',min:10},col:'#3B5BDB',auIx:['syd','mel'],pops:BIGC,ix:'ALL',blurb:tr('networks.social_media_everyone_keeps_falling')}, diff --git a/src/game/60-features/80-new-game.js b/src/game/60-features/80-new-game.js index d2d25c5..632d43f 100644 --- a/src/game/60-features/80-new-game.js +++ b/src/game/60-features/80-new-game.js @@ -1,6 +1,6 @@ function newGame(name,home){ S={v:1,name,asn:200000+Math.floor(_rand()*15000),home,day:0,cash:START_CASH, - ltv:2,t1v:3,auV:1,ops:opsNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, + ltv:2,t1v:4,auV:1,ops:opsNew(),achP:{},seen:NETS.map(n=>n.id),spares:{},pops:{[home]:{day:0,bb:null,boost:0,down:0,routers:1,gen:false}},links:[],nni:[],transit:[],ixp:{},rs:{},peers:{},pni:[],caches:[],biz:[],offers:[],myIx:{},pairMet:{}, done:{},inc:[],fleet:{},ev:{ddosMore:[]},ddosStarts:[],priceMul:1,nextFail:45,nextEvent:40,usedNames:[],stats:{survived:0,incidents:0,peak:0},cnLic:{state:'none'},scrubs:[],scrubMode:'always',ddosAuto:{rtbh:false,scrub:true},capDeal:null,core:{lv:0,run:0},popStd:null,won:false,lost:false,neg:0,loans:[],loanOffers:[],loanStrikes:0,ppol:'open',pdesk:null,pdeskRep:null,hw:{},rules:makeRules('oncall'),charter:'global',chartSet:false,demo:{},seatOff:null,solWon:0,monkey:{next:null,on:0}}; } diff --git a/src/game/70-rules/30-pnis.js b/src/game/70-rules/30-pnis.js index c8605aa..bb8a2e5 100644 --- a/src/game/70-rules/30-pnis.js +++ b/src/game/70-rules/30-pnis.js @@ -2,7 +2,7 @@ Big content networks, Tier 1s and big eyeball networks usually deliver a PNI or an augment in about 30 days, but 15% of orders get lost in provisioning for 6 to 12 months. The content networks and Tier 1s start at 100G. Doitsche Telekomm sells PNIs down to 1G, and takes its time too. */ const pniBig=id=>{const n=NET[id];return n.type==='t1'||(n.type==='cdn'&&n.pol!=='open')||(n.type==='eye'&&n.share>=0.02);}; -const pniMin=id=>{const n=NET[id];return n.type==='t1'||(n.type==='cdn'&&n.pol!=='open')?1:0;}; +const pniMin=id=>{const n=NET[id];return n.type==='t1'&&!pniG1(id)||(n.type==='cdn'&&n.pol!=='open')?1:0;}; const pniG1=id=>id==='dtk'; // A beer with their peering coordinator at a conference halves the wait. It is how it really works. const PNI_SLOW=0.15,pniLead=id=>{const n=pniBig(id)?(Math.random()S.day?Math.round(n/2):n);}; diff --git a/src/game/70-rules/80-hot-ports-and-rank.js b/src/game/70-rules/80-hot-ports-and-rank.js index f329437..990cde3 100644 --- a/src/game/70-rules/80-hot-ports-and-rank.js +++ b/src/game/70-rules/80-hot-ports-and-rank.js @@ -11,8 +11,9 @@ function hotPorts(){const out=[];if(!R||!S)return out; function hotByCity(){const m={};for(const h of hotPorts())(m[h.city]=m[h.city]||{})[h.k]=Math.max((m[h.city]||{})[h.k]||0,h.u);return m;} function isTier2(){return Object.keys(S.pops).length>=5&&Object.keys(S.ixp).length>=3&&R.sessions>=15;} // Sparkly Seabone joined the Tier 1s in 1.12. Older saves keep the five they were playing for. -// Tier 1s added later only count for games started after them, so old saves keep their win (#155). -const t1Need=()=>NETS.filter(n=>n.type==='t1'&&(n.id!=='skl'||(S&&S.t1v>=2))&&(n.id!=='att'||(S&&S.t1v>=3))); +// Tier 1s added later only count for games started after them, so old saves keep their win (#155, #194). +const T1_SINCE={att:3,dtk:4,skl:2,tng:4}; +const t1Need=()=>NETS.filter(n=>n.type==='t1'&&(!T1_SINCE[n.id]||(S&&S.t1v>=T1_SINCE[n.id]))); /* Reach is counted through customer cones (#85): a PNI with a Tier 1 reaches everyone who buys transit from it, and their customers. That only ever adds reach, so the rule is easier for every save, old ones included, and needs no version: what was Tier 1 stays Tier 1. Networks in nobody's cone still need peering of their own. */ diff --git a/src/game/93-ui/70-link-panels.js b/src/game/93-ui/70-link-panels.js index 623b7d0..eddfb18 100644 --- a/src/game/93-ui/70-link-panels.js +++ b/src/game/93-ui/70-link-panels.js @@ -173,7 +173,7 @@ function svgChart(rows,stackKeys,lines,fmtY){ let IXMR=null,IXMC={};const ixHas=(x,id)=>{if(IXMR!==R){IXMR=R;IXMC={};}return (IXMC[x]||(IXMC[x]=new Set(ixMembers(x)))).has(id);}; // Who brings a network along (#85): the nearest of its upstreams, then theirs; null if it sits in nobody's cone. function coneVia(id){const a=ANC[id];if(!a||!a.length)return null;const t1=a.find(u=>NET[u].type==='t1');return NET[t1||a[0]];} -function offTransitHint(id,city){const n=NET[id];if(n.type==='t1')return tr('link_panels.tier_1_only_a_pni_and'); +function offTransitHint(id,city){const n=NET[id];if(n.type==='t1'&&n.pol==='restrictive')return tr('link_panels.tier_1_only_a_pni_and'); const ixc=Object.keys(S.pops).flatMap(ixIdsIn).filter(x=>ixHas(x,id)),here=city&&ixIdsIn(city).find(x=>ixHas(x,id))||null,pick1=here||ixc.find(x=>S.ixp[x]!==undefined)||ixc[0]; if(n.pol==='open'){if(pick1)return here||ixNamesCity(pick1)?tr('link_panels.open_peer_join_the_route_server',{ix:ixName(pick1)}):tr('link_panels.open_peer_join_the_route_server_01a1',{ix:ixName(pick1),city:CITY[ixCity(pick1)].name});const x=nearestSpot(id);return x?tr('link_panels.open_peer_but_not_on_any',{city:CITY[x.c].name}):tr('link_panels.open_peer_but_not_on_any_bfbb');} if(n.pol==='paid')return paidFree(n)?tr('link_panels.peers_with_you_for_free_over'):n.freeLv?tr('link_panels.paid_peering_only_a_pni_costs',{price:fmt$(n.paidFee),n:n.freeLv}):tr('link_panels.paid_peering_only_a_pni_costs_921d',{price:fmt$(n.paidFee)}); diff --git a/tests/gameplay-rules.test.js b/tests/gameplay-rules.test.js index 02df5b5..65612ac 100644 --- a/tests/gameplay-rules.test.js +++ b/tests/gameplay-rules.test.js @@ -41,7 +41,6 @@ const EXCEPTIONS = { cun: 'China (#59)', cxc: 'buys from Spectre-um, which is transit-free', drz: 'a transit-free Tier 2', - dtk: 'transit-free incumbent', etc: 'Cuba: buys from Sparkly Seabone, a Tier 1 only for games since 1.12', ets: 'transit-free in the Gulf', ftr: 'buys from Very-Zone, which is transit-free', @@ -69,7 +68,6 @@ const EXCEPTIONS = { tmt: 'buys from Sparkly Seabone, a Tier 1 only for games since 1.12', tmx: 'transit-free in Mexico', tmy: 'Malaysian incumbent, peers for its own reach', - tng: 'a transit-free Tier 2', tpr: 'Australian (#148)', tsf: 'Indonesian incumbent, peers for its own reach', tsy: 'Australian, transit-free (#148)', @@ -121,9 +119,9 @@ test('W1: every city has a country code, a region and real coordinates', () => { test('W2: every country on the map has at least two consumer networks of its own', () => { // "Own": the network names the country in its home markets (cc) and has a PoP there. Consumer networks are the - // eyeballs, and the Tier 2 incumbents that sell to homes and phones in their home markets. + // eyeballs, and the Tier 1 and Tier 2 incumbents (Doitsche, Tangerine) that sell to homes and phones there. const rows = J(`(()=>{const cs={};for(const c of CITIES)if(!c.off)(cs[c.cc]=cs[c.cc]||[]).push(c.id); - return Object.keys(cs).sort().map(cc=>[cc,NETS.filter(n=>(n.type==='eye'||n.type==='t2')&&[].concat(n.cc||[]).includes(cc)&&n.pops.some(p=>CITY[p].cc===cc)).map(n=>n.name)]);})()`); + return Object.keys(cs).sort().map(cc=>[cc,NETS.filter(n=>n.type!=='cdn'&&[].concat(n.cc||[]).includes(cc)&&n.pops.some(p=>CITY[p].cc===cc)).map(n=>n.name)]);})()`); const bad = rows.filter(([cc, own]) => own.length < 2 && !ex('W2', cc)) .map(([cc, own]) => `${country(cc)} (${cc}) has ${own.length} own eyeball network${own.length === 1 ? '' : 's'}${own.length ? ': ' + own.join(', ') : ''}`); fail('W2', bad, 'add a real operator of that country (src/game/30-networks/32-homegrown-eyeballs.js) or list it in EXCEPTIONS with a reason'); diff --git a/tests/issues.test.js b/tests/issues.test.js index 62607c3..f8e8de9 100644 --- a/tests/issues.test.js +++ b/tests/issues.test.js @@ -572,8 +572,8 @@ test('buttons behind an open modal stay quiet, and a declined PNI clears its sta 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:'mrs'});ACT.buyTransit({city:'mrs',net:'cog',tier:1});compute()"); // the PNI button was drawn while Tangerine still wanted our traffic; by the click it doesn't - // Tier 2 is folded when nothing there is worth a PNI (#175): open it, as a player would. - ev("UI.pniOpen={t2:true};R.demTo.tng=50;UI.sel={type:'city',id:'mrs'};UI.tab='peer';renderAll();R.demTo.tng=0;window.__n=0;const o=toast;toast=function(h){if(/declined/.test(h))window.__n++;return o.apply(this,arguments);}"); + // Tier 1 is folded when nothing there is worth a PNI (#175): open it, as a player would. + ev("UI.pniOpen={t1:true};R.demTo.tng=50;UI.sel={type:'city',id:'mrs'};UI.tab='peer';renderAll();R.demTo.tng=0;window.__n=0;const o=toast;toast=function(h){if(/declined/.test(h))window.__n++;return o.apply(this,arguments);}"); const btn = "document.querySelector('#panel [data-act=pni][data-args*=tng]')"; assert.ok(ev(`!!${btn}`), 'a stale button to start with'); ev(`${btn}.focus();${btn}.click()`); diff --git a/tests/regions.test.js b/tests/regions.test.js index 6faaee6..c84c98d 100644 --- a/tests/regions.test.js +++ b/tests/regions.test.js @@ -358,7 +358,9 @@ test('Sparkly Seabone is a Tier 1 now, but old saves keep the five they played f ev("ACT.start({})"); assert.equal(ev("NET.skl.type"), 't1'); assert.ok(ev("NET.skl.pops.includes('nyc')&&NET.skl.pops.includes('sao')&&NET.skl.pops.includes('pmo')")); - assert.equal(ev("t1Need().length"), 7, 'new games need all seven, AT&Tease included (#155)'); + assert.equal(ev("t1Need().length"), 9, 'new games need all nine, AT&Tease (#155), Doitsche and Tangerine (#194) included'); + ev("S.t1v=3"); + assert.equal(ev("t1Need().length"), 7, 'saves from before Doitsche and Tangerine keep seven'); ev("S.t1v=2"); assert.equal(ev("t1Need().length"), 6, 'saves from before AT&Tease keep six'); ev("delete S.t1v"); diff --git a/tests/tier1-cone.test.js b/tests/tier1-cone.test.js index 55b5372..b0622e1 100644 --- a/tests/tier1-cone.test.js +++ b/tests/tier1-cone.test.js @@ -57,9 +57,9 @@ test('a transit-free network with PNIs to every Tier 1 reaches the long tail thr test('a network in nobody\'s cone still needs reaching directly', () => { const { ev, errors } = load(); t1Club(ev); - // Doitsche Telekomm buys from no one: no Tier 1 PNI reaches it - assert.equal(ev("(NET.dtk.up||[]).length"), 0); - assert.equal(ev("R.reachable.dtk"), false); + // Comecast buys from no one: no Tier 1 PNI reaches it + assert.equal(ev("(NET.cmc.up||[]).length"), 0); + assert.equal(ev("R.reachable.cmc"), false); assert.equal(ev("isTier1()"), false); assert.match(ev('t1Why()'), /nobody you peer with sells transit to/); // peer with every island directly and the win comes @@ -92,7 +92,8 @@ test('a peer\'s cone comes after direct peering and before transit, so peering w assert.ok(ev(`(R.netEg.${id}||{}).p`) > 0, 'over the PNI with its upstream, not over transit'); assert.equal(ev(`(R.netEg.${id}||{}).t||0`), 0); // a direct session beats the cone: peer with it at the exchange and its traffic moves there - ev(`S.pops.fra.bb.d=500;ACT.buyIx({city:'fra',tier:1,signed:true});ACT.rs({city:'fra'});compute()`); + // eight Tier 1 PNIs and the transit port fill the router (#194): a second one makes room for the exchange port + ev(`S.pops.fra.bb.d=500;S.pops.fra.routers=2;ACT.buyIx({city:'fra',tier:1,signed:true});ACT.rs({city:'fra'});compute()`); if (ev(`ixSessions('fra').has('${id}')`)) { assert.ok(ev(`(R.netEg.${id}||{}).ix`) > 0, 'direct peering wins over the cone'); assert.equal(ev(`(R.netEg.${id}||{}).p||0`), 0); diff --git a/tests/tier1-incumbents.test.js b/tests/tier1-incumbents.test.js new file mode 100644 index 0000000..97a6316 --- /dev/null +++ b/tests/tier1-incumbents.test.js @@ -0,0 +1,66 @@ +// #194: Doitsche Telekomm and Tangerine Telecom are Tier 1s, as in real life. They count for the Tier 1 goal +// in games started after the change; older saves keep the Tier 1s they were playing for. +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +test('#194 Doitsche Telekomm and Tangerine Telecom are Tier 1s', () => { + const { ev, errors } = load(); + ev("ACT.start({})"); + assert.equal(ev("NET.dtk.type"), 't1'); + assert.equal(ev("NET.tng.type"), 't1'); + assert.equal(ev("TYPE_L[NET.dtk.type]"), 'Tier 1'); + assert.deepEqual(errors, []); +}); + +test('#194 new games need both for Tier 1, old saves keep their set', () => { + const { ev, errors } = load(); + ev("ACT.start({})"); + const need = () => ev("t1Need().map(n=>n.id).sort().join()"); + assert.equal(need(), 'att,cog,dtk,lvl,ntt,skl,tat,tly,tng', 'new games need all nine'); + ev("S.t1v=3"); + assert.equal(need(), 'att,cog,lvl,ntt,skl,tat,tly', 'saves from 1.x and 2.x keep seven'); + ev("S.t1v=4;const o=JSON.parse(JSON.stringify(S));S=migrate(o)"); + assert.equal(ev("S.t1v"), 4, 'the version survives a save'); + ev("delete S.t1v"); + assert.equal(ev("t1Need().length"), 5, 'the oldest saves keep five'); + assert.deepEqual(errors, []); +}); + +test('#194 the Road to Tier 1 names them when the PNIs are missing', () => { + const { ev, errors } = load(); + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=6;for(const g of GOALS)S.done[g.id]=0;delete S.done.t1;ACT.launchBB({city:'fra'})"); + ev("S.transit=[];S.pni=[];for(const n of t1Need())if(n.id!=='dtk'&&n.id!=='tng')S.pni.push({id:'p'+n.id,net:n.id,city:'fra',tier:2});compute()"); + assert.equal(ev("isTier1()"), false); + assert.match(ev("t1Why()"), /Doitsche Telekomm/); + assert.match(ev("t1Why()"), /Tangerine Telecom/); + assert.deepEqual(errors, []); +}); + +test('#194 Doitsche sells the dearest transit in Europe and still charges for peering; Tangerine sells it cheaper', () => { + const { ev, errors } = load(); + ev("ACT.start({})"); + assert.equal(ev("sellsAt(NET.dtk,'fra')"), true, 'Doitsche sells transit in Frankfurt'); + assert.equal(ev("NETS.filter(n=>n.id!=='dtk'&&!n.cn&&n.price&&n.pops.some(c=>CITY[c].reg==='EU')).every(n=>n.price { + const { ev, dom, errors } = load(); + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip()"); + dom.window.innerWidth = 360; + ev("UI.sel={type:'city',id:'fra'};UI.tab='up';renderAll()"); + const html = dom.window.document.getElementById('panel').innerHTML; + assert.match(html, /Doitsche Telekomm Tier 1