/* west-flicker's method, but with the camera PINNED ON THE CANAL — which is the one place the shipped gate can never look, because it pins at the map's start and the channel is 100+ m away. */ const R='/Users/eden/Github/CyberCity/',fs=require('fs'); global.CC=require(R+'src/core.js');global.window=undefined; ['world','proj','daylight','weather_state','city','surfaces','raycast','control'].forEach(m=>require(R+'src/'+m+'.js')); fs.readdirSync(R+'src').sort().forEach(p=>{if(/^surf_.*\.js$/.test(p))require(R+'src/'+p)}); fs.readdirSync(R+'src/elements').sort().forEach(p=>require(R+'src/elements/'+p)); const COLS=120,ROWS=40,WARM=360,NF=WARM+240,PROBES=[3.5,5,7,9,12,15,19]; function goertzel(x,f){const n=x.length,w=2*Math.PI*f/60,c=2*Math.cos(w);let s1=0,s2=0,m=0; for(let i=0;iCC.inWorld(e,'japan')).sort((a,b)=>(a.layer|0)-(b.layer|0)); const rng=CC.mulberry(seed^0x9e3779b9); for(const el of live) if(el.init) el.init(city,rng,{cols:COLS,rows:ROWS}); // walk the autopilot until it is dOff metres from the channel, then PIN there const cam={x:city.startX,z:city.startZ,yaw:0,eyeY:1.7,fov:1.25,horizon:ROWS*0.56,cellAspect:0.5625,rows:ROWS,t:0}; let found=false; for(let k=0;k<40000;k++){CC.Daylight.update(1/60,k/60);CC.Weather.update(1/60,k/60);CC.Control.update(1/60,k/60,cam,city); if(Math.abs(city.rivD(cam.x,cam.z)-dOff)<0.9){found=true;break;}} if(!found) return null; /* SCOPED EXACTLY AS tools/west-flicker.cjs SCOPES IT: only elements EXCLUSIVE to this world are drawn. A shared element (the crowd, the rain) is part of the baseline every world carries and the tool's own header spends a paragraph on why it is not this world's to answer for. Drawing them here measured the pedestrians and called it the canal. */ const drawn=live.filter(e=>e.world&&CC.inWorld(e,'japan')&&!CC.inWorld(e,'cyber')); const f=CC.makeFrame(COLS,ROWS),N=COLS*ROWS,keep=NF-WARM,s=new Uint8Array(N*keep); const isWater=new Uint8Array(N); for(let k=0;k=WARM){const b=(k-WARM)*N;for(let i=0;iROWS*0.56){isWater[i]=1;water++;} } let big=0,band=0,worst=0;const x=new Float64Array(keep); for(let i=0;imx)mx=d;if(d>85)b++;prev=v;x[k]=v;} x[0]=s[i]; if(b/(keep/60)>big)big=b/(keep/60); if(mx>worst)worst=mx; for(const fq of PROBES){const a=goertzel(x,fq);if(a>band)band=a;}} return {water,worst:(100*worst/255).toFixed(1),big:big.toFixed(2),band:(100*band/255).toFixed(2)}; } for(const [seed,dOff] of [[42,2],[42,8],[3,2],[3,8]]) for(const p of ['kiri','typhoon']) { const r=run(p,seed,false,dOff); console.log('seed',seed,'dist-to-channel',dOff+'m',p.padEnd(8),r?`waterCells ${String(r.water).padStart(4)} worstStep ${r.worst}% bigSteps ${r.big}/s 3-20Hz ${r.band}%`:'(never reached)'); } const rm=run('typhoon',42,true,2); console.log('reduced-motion @2m typhoon:', rm?`waterCells ${rm.water} worstStep ${rm.worst}% bigSteps ${rm.big}/s 3-20Hz ${rm.band}%`:'n/a');