Architect runs: the chaos monkey leaves when you move on to the next brief
This commit is contained in:
parent
170914b05e
commit
b04e1e22c1
2 changed files with 2 additions and 2 deletions
|
|
@ -125,7 +125,7 @@ function arApply(i){const A=S.ar,P=S.pz,b=arRun().briefs[i];A.bi=i;
|
|||
arDemand();A.start=arSnapStr();UI.pzHist=[];UI.sel=null;UI.arFail=null;
|
||||
compute();pzCam();renderAll();
|
||||
toast(`<b>${tr('architect.brief_n_of_m',{n:i+1,m:arRun().briefs.length})}</b><br>${esc(b.t)}`,'goal');sfx('click');}
|
||||
function arNext(){if(!arOn())return;const e=arEval();if(!e.passed)return;if(arLast()){arResults(true);return;}S.ar.over+=e.tubes.over;arApply(S.ar.bi+1);}
|
||||
function arNext(){if(!arOn())return;const e=arEval();if(!e.passed)return;mkStop();if(arLast()){arResults(true);return;}S.ar.over+=e.tubes.over;arApply(S.ar.bi+1);}
|
||||
function arReset(){const o=JSON.parse(S.ar.start);S.pops=o.p;S.links=o.l;S.pairMet=o.m||{};S.ar.sunk=o.k||0;arDemand();UI.sel=null;}
|
||||
// Tubes over plan in the run so far, this brief included.
|
||||
const arOver=()=>S.ar.over+arTubes().over;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ test('architect runs: every reference passes each brief, on plan and within budg
|
|||
plan.forEach((steps, i) => {
|
||||
for (const s of steps) if (s[0] === '@rm') ev(`ACT.pzRmPop({city:'${s[1]}'})`); else lay(ev, ...s);
|
||||
assert.equal(review(ev), true, `${id} brief ${i + 1}: ${ev('arEval().why')} ${ev('JSON.stringify(UI.arFail)')}`);
|
||||
if (i < plan.length - 1) ev('ACT.pzArNext()');
|
||||
if (i < plan.length - 1) { ev('ACT.pzArNext()'); assert.equal(ev('UI.mk'), null, `${id}: the monkey leaves with the next brief`); }
|
||||
});
|
||||
assert.equal(ev('arOver()'), 0, `${id}: never over a brief's tubes`);
|
||||
assert.equal(ev('arSpend()<=arRun().budget'), true, `${id}: within budget`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue