Island Wi-Fi, Starblink and late joiners work together
Checked after merging the three, and pinned with a test (tests/late-joiners.test.js): a late network with a Starblink zone and a lit spur pays its islanders' income in full but has only its homes matched; investors on a revenue share take their cut of homes, islands and an IPv4 lease, never of the match; a spur cut and a solar storm need a lit spur or a LEO circuit, not a number of days, and come on the network's own outage schedule (S.nextFail, counted from S.day0), so no grace needed moving; a reload keeps the game. - CHANGELOG: Island Wi-Fi names zones as the game does (Abaco and Eleuthera) and says a spur has upkeep but no rent. - Agent: a stray "., " in the pops doc where the Starblink and Island Wi-Fi lines met. - Plans: open question 6 (WISP zones and a rented LEO tier) marked answered and built.
This commit is contained in:
parent
dcdb501f16
commit
66ac7d0af1
4 changed files with 41 additions and 5 deletions
|
|
@ -217,3 +217,38 @@ test('a network that began on day 0 shows none of it', (t) => {
|
|||
assert.deepEqual([ev('lateCard()'), ev('lateBank()')], ['', '']);
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
||||
// Island Wi-Fi and Starblink (#83) on a late network: what islanders pay is theirs to share with investors (as an IPv4
|
||||
// lease is) and is never matched; a spur cut or a solar storm is a failure like any other, drawn only once a lit spur or
|
||||
// a LEO circuit is up and only on the network's own outage schedule (S.nextFail, counted from S.day0), no calendar grace.
|
||||
test('a late network with island Wi-Fi and Starblink: islanders are not matched, investors share islands and IPv4 leases but not the match', (t) => {
|
||||
const { ev, errors } = late(t, { home: 'suv' });
|
||||
const Z = "wispZ('vanualevu')", sp = "wispZ('tobago')";
|
||||
assert.equal(ev('S.nextFail-S.day0'), 45, 'the first outage 45 days into its own life');
|
||||
ev(`S.cash=1e8;for(const g of GOALS)S.done[g.id]=0;S.lvl=5;
|
||||
ACT.launchBB({city:'suv'});S.pops.suv.bb.d=8;ACT.buyTransit({city:'suv',net:NETS.find(n=>sellsAt(n,'suv')).id,tier:1});
|
||||
ACT.teleBuild({city:'suv'});ACT.teleLeo({city:'suv'});ACT.wispSat({z:'vanualevu',bird:LEO_BIRD,g:5});
|
||||
ACT.buildPop({city:'pos'});ACT.buyTransit({city:'pos',net:NETS.find(n=>sellsAt(n,'pos')).id,tier:1});ACT.wispSpur({z:'tobago'});
|
||||
${Z}.sat.ready=S.day;${sp}.sp.ready=S.day;${Z}.d=4;${sp}.d=2;compute()`);
|
||||
assert.equal(ev('netAge()'), 0);
|
||||
assert.equal(ev('leoLive()') && ev('wispSpurs().length'), 1, 'a LEO zone in the sky and a lit spur on its first day');
|
||||
// The pool a failure draws from, on its first day: both are there, with no grace of their own.
|
||||
const pool = () => J(ev, "(()=>{window.__o=null;runNow(eval('('+failureRun.toString().replace('if(!opts.length)return;','__o=opts.map(o=>o[0]);return;')+')')());return __o;})()");
|
||||
assert.ok(pool().includes('leostorm') && pool().includes('wspur'), 'a storm and a cut are possible failures from day one');
|
||||
// The money: islanders pay, homes are matched, the islands are not.
|
||||
const r = J(ev, 'R.rev');
|
||||
assert.ok(r.wisp > 0 && r.eyeballs > 0, `islanders and homes both pay (${r.wisp}, ${r.eyeballs})`);
|
||||
assert.equal(r.late, r.eyeballs, 'the match is what homes pay, never what islanders pay');
|
||||
// Investors: their share of homes, islands and an IPv4 lease, never of the match.
|
||||
ev("S.loans.push({id:'v',bank:'vult',start:S.day,amount:1,got:1,bal:0,share:0.1,covs:[]});ACT.ip4Buy({len:20});ACT.ip4Out({id:S.ip4.b.find(b=>b.k==='buy').id});compute()");
|
||||
const m = J(ev, '[R.rev,R.cost.revshare,R.revMo]'), v = m[0];
|
||||
assert.ok(v.ip4 > 0 && v.wisp > 0 && v.late > 0, `a lease, islanders and a match (${v.ip4}, ${v.wisp}, ${v.late})`);
|
||||
assert.ok(Math.abs(m[1] - 0.1 * (v.eyeballs + v.business + v.ix + (v.orbit || 0) + v.ip4 + v.wisp)) < 1e-6, 'investors take 10% of homes, islands and the lease');
|
||||
assert.ok(Math.abs(m[1] - 0.1 * (m[2] - v.grant - (v.gov || 0) - v.late)) < 1e-6, 'of every revenue but grants and the match');
|
||||
// Its first outage comes on its own schedule, and the pool still holds both: a storm or a cut can be that outage.
|
||||
ev("window.__fr=[];const f0=failureRun;failureRun=function*(o){__fr.push(netAge());yield* f0(o);};S.nextEvent=1e9;__reseed(5)");
|
||||
for (let i = 0; i < 46; i++) ev('dayTick()');
|
||||
assert.equal(J(ev, '__fr')[0], 45, 'no failure before age 45');
|
||||
assert.equal(same(ev), true, 'a reload makes the same game');
|
||||
assert.deepEqual(errors, []);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue