diff --git a/CHANGELOG.md b/CHANGELOG.md index bbfce26..0c94f3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project are documented here. The project follows - Puzzles are easier to read, above all on phones: the three stars are now three goals in plain words, and the one you are working on says what is wrong and what to do, with a Show me button. The map marks it too: a red ring around a city that still needs traffic, and a pulsing ✂ on a link whose cut would hurt. On phones the sheet starts small so the map gets the screen; swipe it up for the rest. Cities far from the puzzle are left off the map, and stepping stones you are not using are small dots without a name until you tap one, build there or zoom in. - Clean traffic that a scrubbing center sends back to a customer under attack no longer shows as DDoS junk on your backbone links; a link now lists it as scrubbed clean traffic, so a small flood no longer looks like hundreds of gigabits of junk (#289). - Alien waves you rent out on your dark fiber are now priced against the fiber itself: a wave costs a share of what leasing and lighting that fiber would cost the buyer, and each wave sold between the same two cities goes a little cheaper than the last. A route sold out to its market now earns a few times its lease, not dozens, and contracts already signed keep their price (#203). +- Leasing a dark fiber pair now costs about half as much again ($600 plus $1.50 per km a month, amplifiers as before), so it pays off once you light a couple of 400G waves on it. Leases you already hold keep their price (#203). - Extra crews can now cut a fiber build on land to half its planned time at most, since permits and rights of way do not speed up; the button shows the day it would be done (#203). - A link ordered by typing both ends (the AI tools) can no longer end in a city the map does not show (#203). ## [2.9.1] — 2026-11-04 diff --git a/src/game/10-catalog/50-dark-fiber.js b/src/game/10-catalog/50-dark-fiber.js index ef602d1..b03c36a 100644 --- a/src/game/10-catalog/50-dark-fiber.js +++ b/src/game/10-catalog/50-dark-fiber.js @@ -16,7 +16,9 @@ const OPT={ tp16:{n:'Sienna WaveMagic 1.6T',g:1600,cost:70000,reach:4000,modes:[[1600,4000],[1200,5500],[800,7000],[400,12000]],rg:2,lvl:4,sys:'roadm',blurb:tr('dark_fiber.big_shelf_big_reach_big_invoice')}, tp32:{n:'Sienna WaveMagic 3.2T',g:3200,cost:130000,reach:1500,modes:[[3200,1500],[1600,4000],[1200,5500],[800,7000],[400,12000]],rg:4,lvl:8,sys:'roadm',blurb:tr('dark_fiber.twice_the_wavemagic_full_speed_only')}, }; -const dfLeaseMo=km=>Math.round(400+km*1.0); +// A leased fiber pair, per month. Dear enough that it pays off at a couple of 400G waves, as dark fiber does (#203); +// a lease already signed keeps its price (l.mo). +const dfLeaseMo=km=>Math.round(600+km*1.5); const dfBuildCost=km=>Math.round((25000+km*120)*hwMul('build')); const dfBuildDays=km=>leadDays(Math.round(120+km*0.25)),IRU_DAYS=30; const ampCount=km=>Math.max(0,Math.floor(km/AMP_EVERY)); diff --git a/tests/alien-wave-rent.test.js b/tests/alien-wave-rent.test.js index 9bd353e..92b68e1 100644 --- a/tests/alien-wave-rent.test.js +++ b/tests/alien-wave-rent.test.js @@ -65,3 +65,17 @@ test('#203 a dark fiber, cable or wave cannot be ordered to a city the map does assert.equal(ev(`S.links.some(l=>l.b==='${off}'||l.a==='${off}')`), false); assert.deepEqual(errors, []); }); + +test('#203 a dark fiber lease costs more, and a lease already signed keeps its price', () => { + const { ev, errors } = load(); + ev("ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.cash=1e9;S.lvl=4;for(const c of ['fra','ams'])if(!S.pops[c])ACT.buildPop({city:c})"); + assert.equal(ev('dfLeaseMo(1000)'), 2100); + ev("UI.pending={a:'fra',b:'ams'};UI.dfSrc='lease';UI.dfSys='lite';ACT.orderDf()"); + const km = ev("S.links.find(l=>l.kind==='df').km"); + assert.equal(ev("S.links.find(l=>l.kind==='df').mo"), Math.round(600 + km * 1.5)); + // An old save's lease, signed at the old price, keeps it. + const old = Math.round(400 + km); + ev(`S.links.find(l=>l.kind==='df').mo=${old};S=migrate(JSON.parse(JSON.stringify(S)))`); + assert.equal(ev("S.links.find(l=>l.kind==='df').mo"), old); + assert.deepEqual(errors, []); +}); diff --git a/tests/route-fuzz.test.js b/tests/route-fuzz.test.js index 4ac9d80..ff2980e 100644 --- a/tests/route-fuzz.test.js +++ b/tests/route-fuzz.test.js @@ -16,10 +16,11 @@ function pages() { let base = head; try { const b = path.join(os.tmpdir(), `tubes-fuzz-test-${process.pid}-base.html`); fs.writeFileSync(b, page.assembleRef('origin/main')); base = b; } catch (e) {} let P = { base: openPage(base, 'base'), head: openPage(head, 'head') }; - // A change to the world itself (cities, networks, cables) cannot route like main: there is no same game to compare. - // Then the base is this checkout too, and the cache on/off check still runs; equivalence with main resumes once it lands. - const world = (p) => p.ev("JSON.stringify([CITIES.map(c=>[c.id,c.land,c.P]),NETS.map(n=>[n.id,n.pops,n.ix,n.share,n.price,n.up]),CABLES.map(c=>[c.id,c.pairs.map(q=>[q[0],q[1]])])])"); - if (base !== head && world(P.base) !== world(P.head)) { console.log('# route fuzz: the world differs from main, so both pages are this checkout'); P = { base: openPage(head, 'base'), head: P.head }; } + // A change to the world itself (cities, networks, cables) or to what links cost cannot route like main: there is no + // same game to compare. Then the base is this checkout too, and the cache on/off check still runs; equivalence with + // main resumes once it lands. + const world = (p) => p.ev("JSON.stringify([CITIES.map(c=>[c.id,c.land,c.P]),NETS.map(n=>[n.id,n.pops,n.ix,n.share,n.price,n.up]),CABLES.map(c=>[c.id,c.pairs.map(q=>[q[0],q[1]])]),[1,300,3000].map(k=>[dfLeaseMo(k),waveMo(k,false,2),dfBuildCost(k)])])"); + if (base !== head && world(P.base) !== world(P.head)) { console.log('# route fuzz: the world or its prices differ from main, so both pages are this checkout'); P = { base: openPage(head, 'base'), head: P.head }; } return P; }