Every transport piece moves material at belt speed and capacity (t105)

This commit is contained in:
2026-10-30 03:34:39 -04:00
parent e605953661
commit 1740f598eb
20 changed files with 413 additions and 126 deletions
+8 -5
View File
@@ -5,11 +5,11 @@ const { check, done } = suite();
function fresh() { flatWorld(run, 320, 200, 120); run('bot.x = 20; bot.y = 40; money = 1e6; globalThis.__got = 0;'); }
const screwLiquid = () => run('(() => { let n = 0; for (let i = 0; i < N; i++) if (part[i] >= P_SCREW_U && part[i] <= P_SCREW_R && PH[mat[i]] === PH_LIQUID) n++; return n; })()');
// grains that land in the sink region are counted and taken away, so outlets never back up
function rate(x0, x1, y0, y1, warm, meas) {
function rate(x0, x1, y0, y1, warm, meas, sample = '') {
const sink = `for (let y=${y0};y<=${y1};y++) for (let x=${x0};x<=${x1};x++) { const i=y*W+x; if (mat[i]===SAND) { mat[i]=EMPTY; __got++; } }`;
for (let k = 0; k < warm; k++) run(`simTick(); ${sink}`);
for (let k = 0; k < warm; k++) run(`simTick(); ${sample} ${sink}`);
run('__got = 0');
for (let k = 0; k < meas; k++) run(`simTick(); ${sink}`);
for (let k = 0; k < meas; k++) run(`simTick(); ${sample} ${sink}`);
return run('__got') / (meas / 60);
}
@@ -116,8 +116,11 @@ fresh();
run('for (let y = 120; y < 196; y++) for (let x = 90; x < 130; x++) setCell(y*W+x, EMPTY, AMB[y], 0)');
rect(run, 90, 130, 129, 195, run('SAND'));
run('for (let by = 20; by <= 37; by++) placeBlock(BP_SCREW, 0, 26, by, true); for (let bx = 26; bx <= 40; bx++) placeBlock(BP_SCREW, 1, bx, 19, true);');
const lr = rate(164, 319, 80, 119, 400, 300);
const liftLanes = run('(() => { const s = new Set(); for (let y = 76; y < 80; y++) for (let x = 120; x < 160; x++) if (mat[y*W+x] === SAND) s.add(y); return s.size; })()');
// Observe while the finite pit feeds the lift: faster turns can empty it before the final tick.
run('globalThis.__liftLanes = new Set();');
const lr = rate(164, 319, 80, 119, 400, 300,
'for(let y=76;y<80;y++)for(let x=120;x<160;x++)if(mat[y*W+x]===SAND)__liftLanes.add(y);');
const liftLanes = run('__liftLanes.size');
check('a lift turns its corner without squeezing down to one lane', liftLanes === 4 && lr > 30, `${lr.toFixed(0)}/s, ${liftLanes} lanes at the top`);
fresh();
run('for (let bx = 20; bx < 32; bx++) placeBlock(BP_BELT, 1, bx, 25, true);');