From 87364af55d3b31f1dd3ca1529b09494d0dd3d7e9 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Fri, 30 Oct 2026 11:42:34 +0100 Subject: [PATCH] Architect runs: a skipped review that passes still ends with the monkey's cheer --- src/game/96-map/87-chaos-monkey.js | 3 ++- tests/architect.test.js | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/game/96-map/87-chaos-monkey.js b/src/game/96-map/87-chaos-monkey.js index d9ccfde..8deeec2 100644 --- a/src/game/96-map/87-chaos-monkey.js +++ b/src/game/96-map/87-chaos-monkey.js @@ -13,7 +13,8 @@ function mkRun(l,dur,bad){const m=UI.mk;if(!m)return;const [x,y]=mkMid(l);m.fx=m function mkSpray(m){for(let i=0;i<(m.bad?26:16);i++){const a=Math.PI*2*i/(m.bad?26:16)+((i*37)%10)/10,v=0.05+((i*53)%10)/180; m.spray.push({x:m.tx,y:m.ty,vx:Math.cos(a)*v,vy:Math.sin(a)*v-0.06,c:m.bad?(i%3?'#FF4D5E':'#FFD23F'):MK_COLS[i%MK_COLS.length],t:animT,s:i%4===0?(m.bad?'💥':'✂️'):null});}} // The review is over: a cheer when everything held, a tantrum where it broke. -function mkEnd(ok){const m=UI.mk;if(!m)return;m.mood=ok?'cheer':'dance';m.t0=animT;} +function mkEnd(ok){const m=UI.mk;if(!m)return;// a pending spray (the review was skipped mid-run) would override the cheer + m.sprayAt=null;m.mood=ok?'cheer':'dance';m.t0=animT;} function mkStop(){UI.mk=null;} function mkDraw(ks){const m=UI.mk;if(!m)return; const p=Math.min(1,(animT-m.t0)/m.dur),e=p<0.5?2*p*p:1-Math.pow(-2*p+2,2)/2; diff --git a/tests/architect.test.js b/tests/architect.test.js index 8439242..322bcbc 100644 --- a/tests/architect.test.js +++ b/tests/architect.test.js @@ -23,6 +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)')}`); + assert.deepEqual(JSON.parse(ev('JSON.stringify([UI.mk.mood,UI.mk.sprayAt])')), ['cheer', null], `${id}: a skipped review that passes still ends in a cheer`); 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`);