Fiber over land inside one country; no circuits between the Koreas
Towns with no road in (Russia's Arctic and Kamchatka, Juneau and Alaska's Arctic coast, Greenland's towns) keep their own landmass, which now says which land it is really part of. isSub() lets two cities of one country on that land build over land; other countries still need the sea. Inside one country, Europe to Asia (Moscow-Vladivostok, Istanbul-Ankara) is no longer a crossing between continents. North and South Korea join Kyiv-Moscow in a table of pairs nobody sells a circuit between: the link window says so, the actions refuse, and neither the diversity map nor the latency floor counts a link there.
This commit is contained in:
parent
ac5ce7fa05
commit
08bf22cfec
19 changed files with 125 additions and 43 deletions
|
|
@ -1,31 +1,39 @@
|
|||
// #273: a latency offer only asks for a ceiling something you can build meets. Pevek–Anadyr is 635 km apart as the
|
||||
// crow flies, but only a 1,717 km sea route joins them, so a 4.3 ms ceiling can never be met.
|
||||
// #273: a latency offer only asks for a ceiling something you can build meets. Iqaluit and Nuuk are about 750 km apart
|
||||
// as the crow flies, but no cable lands in Iqaluit and no road reaches it, so a 5.5 ms ceiling can never be met.
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
const { load } = require('./harness');
|
||||
|
||||
// Spawn many mars offers from a network at Pevek and Anadyr only: most are between the two.
|
||||
// Spawn many mars offers from a network at two cities only: most are between the two.
|
||||
const marsOnly = "eval('('+spawnOffer.toString().replace('const t=pick(types)',\"const t='mars'\")+')')";
|
||||
const spawn = (ev, n) => ev(`(()=>{S.offers=[];const f=${marsOnly};for(let i=0;i<${n};i++)f();return JSON.stringify(S.offers.map(o=>[o.city,o.city2,o.latMax]));})()`);
|
||||
const start = (ev, cities) => ev(`ACT.start({});S.cash=1e9;S.nextFail=1e9;S.nextEvent=1e9;for(const g of GOALS)S.done[g.id]=0;S.lvl=13;S.pops={};for(const c of ${JSON.stringify(cities)})S.pops[c]={day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};compute()`);
|
||||
|
||||
test('#273 no latency offer between Pevek and Anadyr: no buildable path meets the straight-line ceiling', () => {
|
||||
test('#273 no latency offer between Iqaluit and Nuuk: no buildable path meets the straight-line ceiling', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev, ['pvs', 'dyr']);
|
||||
start(ev, ['yfb', 'nuk']);
|
||||
assert.ok(ev('lvl()') >= 13, 'mars offers are unlocked');
|
||||
assert.equal(ev("latMaxOf('pvs','dyr')"), 4.3);
|
||||
const pair = o => [o[0], o[1]].sort().join('-') === 'dyr-pvs';
|
||||
assert.equal(ev("latMaxOf('yfb','nuk')"), 5.5);
|
||||
const pair = o => [o[0], o[1]].sort().join('-') === 'nuk-yfb';
|
||||
const offers = JSON.parse(spawn(ev, 60));
|
||||
assert.ok(offers.length > 0, 'mars offers still spawn');
|
||||
assert.deepEqual(offers.filter(pair), [], 'but none asks for 4.3 ms between Pevek and Anadyr');
|
||||
assert.ok(!(ev("latFloor('pvs','dyr')") <= 4.3), 'nothing on the map gets there in 4.3 ms');
|
||||
// Even with the player's own Low latency cable, 7.7 ms is the best there is.
|
||||
ev("S.links.push({id:'own1',a:'pvs',b:'dyr',kind:'df',own:true,sub:true,seaDesign:'express',sys:'roadm',ch:[],km:1717,cable:null,mo:1,trench:'own:own1',cut:0,day:0,ready:0,pairs:1});compute()");
|
||||
assert.ok(ev("bestLat('pvs','dyr')") > 4.3);
|
||||
assert.deepEqual(offers.filter(pair), [], 'but none asks for 5.5 ms between Iqaluit and Nuuk');
|
||||
assert.ok(!(ev("latFloor('yfb','nuk')") <= 5.5), 'nothing on the map gets there in 5.5 ms');
|
||||
// Even with the player's own Low latency cable round Baffin Island's coast, the best is above the ceiling.
|
||||
ev("S.links.push({id:'own1',a:'yfb',b:'nuk',kind:'df',own:true,sub:true,seaDesign:'express',sys:'roadm',ch:[],km:1300,cable:null,mo:1,trench:'own:own1',cut:0,day:0,ready:0,pairs:1});compute()");
|
||||
assert.ok(ev("bestLat('yfb','nuk')") > 5.5);
|
||||
assert.deepEqual(JSON.parse(spawn(ev, 60)).filter(pair), []);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#273 Pevek–Anadyr is Russian fiber over land now, so its 4.3 ms offers can be met and do come', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev, ['pvs', 'dyr']);
|
||||
assert.ok(ev("latFloor('pvs','dyr')") <= ev("latMaxOf('pvs','dyr')"));
|
||||
assert.ok(JSON.parse(spawn(ev, 60)).some(o => [o[0], o[1]].sort().join('-') === 'dyr-pvs'));
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
test('#273 latency offers still come where a build meets the ceiling', () => {
|
||||
const { ev, errors } = load();
|
||||
start(ev, ['lon', 'nyc']);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue