Belts carry 4 grains deep; stalled belts warn and stop animating (t45)

This commit is contained in:
2026-10-29 23:21:27 -04:00
parent 99aae0aae0
commit ac5f5a06d1
27 changed files with 335 additions and 51 deletions
+5 -7
View File
@@ -56,11 +56,11 @@ for (const horizontal of [false, true]) {
check(horizontal ? 'a right screw takes grains from above into every row' : 'an up screw takes grains from the side into every column', filled.join() === '3,2,1,0', filled);
}
// A finite heap rides into the side of a six-block lift; remove each mouth flyer once.
// A finite four-grain bed feeds a six-block lift; compare with the same open belt.
const sideSeed = run('RS');
fresh();
run('RS = 7; for (let bx = 16; bx < 32; bx++) placeBlock(BP_BELT, 1, bx, 25, true); for (let by = 19; by <= 24; by++) placeBlock(BP_SCREW, 0, 32, by, true);');
rect(run, 64, 40, 119, 99, run('SAND'));
rect(run, 64, 96, 119, 99, run('SAND'));
const sideLift = run(`(() => {
let out = 0; const lanes = [0, 0, 0, 0];
const grains = () => mat.reduce((n, m) => n + (m === SAND), 0) + flyers.filter(f => f.m === SAND).length;
@@ -75,15 +75,12 @@ const sideLift = run(`(() => {
console.log('Side-fed lift, 3000 ticks: ' + JSON.stringify(sideLift));
check('a belt feeding a lift from the side fills all four lanes', sideLift.lanes.every(n => n > 0), sideLift.lanes);
check('the side-fed lift conserves its sand, including mouth flyers', sideLift.before === sideLift.after, `${sideLift.before} -> ${sideLift.after}`);
// Before side spreading: 1459 grains left this lift in 3000 ticks (one lane, nearly full).
// The same belt and heap deliver 2243 into an open drop, the most the lift can be given.
check('a side-fed lift carries at least 90% of what its belt brings (it was 65%)', sideLift.out >= Math.floor(0.9 * 2243), sideLift.out);
// Same belt and finite heap, with a non-blocking sink at the screw side.
// Same belt and four-grain feed, with a non-blocking sink at the screw side.
run(`RS = ${sideSeed}`);
fresh();
run('RS = 7; for (let bx = 16; bx < 32; bx++) placeBlock(BP_BELT, 1, bx, 25, true);');
rect(run, 64, 40, 119, 99, run('SAND'));
rect(run, 64, 96, 119, 99, run('SAND'));
const beltDelivery = run(`(() => {
let out = 0;
for (let k = 0; k < 3000; k++) {
@@ -97,6 +94,7 @@ const beltDelivery = run(`(() => {
return out;
})()`);
console.log('Belt delivery to a non-blocking sink, 3000 ticks: ' + beltDelivery);
check('a side-fed lift carries at least 90% of what its four-grain belt brings', sideLift.out >= Math.floor(0.9 * beltDelivery), `${sideLift.out} / ${beltDelivery}`);
// --- throughput
fresh();