import { CAMPAIGN } from '../src/data/scenarios'; import { createCity, tickCity, placeBuilding } from '../src/sim/city'; import { ensureSimHooks } from '../src/sim/hooks'; const c = createCity(CAMPAIGN[0]); ensureSimHooks(); let ox=-1, oy=-1; outer: for (let y=8;y{ const f=[...c.buildings.values()].find(b=>b.def==='farmWheat')!; const g=[...c.buildings.values()].find(b=>b.def==='granary')!; const m=[...c.buildings.values()].find(b=>b.def==='market')!; console.log(`--- ${label} (month ${c.month})`); console.log(`farm workers=${f.workersLive} progress=${f.progress.toFixed(2)} wheat=${f.inv['wheat']??0}`); console.log(`granary wheat=${g.inv['wheat']??0}`); console.log(`market workers=${m.workersLive} inv=`, JSON.stringify(m.inv)); const wk=[...c.walkers.values()]; console.log('walkers:', wk.map(w=>`${w.kind}${w.cargo?'('+JSON.stringify(w.cargo)+')':''}`).slice(0,12).join(', ')); const hs=[...c.buildings.values()].filter(b=>b.def==='house'); const fed=hs.filter(h=>((h.goodsStock?.['wheat']??0)+(h.goodsStock?.['fruit']??0))>0).length; console.log(`houses=${hs.length} residents=${hs.reduce((a,b)=>a+b.residents,0)} fed=${fed}`); }; dump('start'); for (let i=0;i<20*20;i++){ tickCity(c,CAMPAIGN[0],0.5); if(i===199||i===399) dump(`t+${Math.round(i*0.5)}s`); }