17 lines
974 B
JavaScript
17 lines
974 B
JavaScript
// t45: sustained normal (one layer) and heavy (16 layers) flat-belt feeds, open sink.
|
|
const {load,flatWorld}=require('../../test/harness');
|
|
const {run}=load();
|
|
for(const depth of [1,16]) {
|
|
flatWorld(run,256,224,208);
|
|
run(`RS=7;AMB.fill(20);temp.fill(20);hot.fill(0);weather.next=1e15;
|
|
for(let bx=10;bx<32;bx++)placeBlock(BP_BELT,1,bx,24,true);`);
|
|
const start=performance.now();
|
|
const rate=run(`(()=>{let out=0;for(let k=0;k<1420;k++){
|
|
for(let l=1;l<=${depth};l++){const i=(96-l)*W+44;if(mat[i]===EMPTY)setCell(i,SAND,20,0);}
|
|
simTick();
|
|
for(let y=0;y<H;y++)for(let x=128;x<W;x++){const i=y*W+x;if(mat[i]===SAND){if(k>=220)out++;setCell(i,EMPTY,20,0);}}
|
|
for(let j=flyers.length-1;j>=0;j--)if(flyers[j].m===SAND&&flyers[j].x>=128){if(k>=220)out++;flyers.splice(j,1);}
|
|
}return out/20;})()`);
|
|
console.log(`${depth===1?'normal':'heavy'}: ${rate.toFixed(1)} grains/s; ${((performance.now()-start)/1420).toFixed(3)} ms/tick including feed/sink`);
|
|
}
|