Screw conveyors join by the shared rule: low ends and verticals join in the corner block (t67 phase 2)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-27 13:30:44 -04:00
co-authored by Claude Opus 5.5
parent 198bea54da
commit fd35bf334f
14 changed files with 358 additions and 209 deletions
+40
View File
@@ -0,0 +1,40 @@
// Shared join grid: eight rows (UR/DR/DL/UL, left/right ends), nine columns.
// Screw H and V, then belt H; each tries the side, above/below, and E.
// Self-contained, paused and empty. Use --zoom 4 --viewport 2100x1500 --no-light.
money = 50000;
for (let y = 40; y < 420; y++) for (let x = 100; x < 560; x++) {
const i = y * W + x;
setCell(i, EMPTY, 20, 0); bgm[i] = 0;
}
for (let x = 100; x < 560; x++) surfY[x] = 420;
window.JOIN_CASES = [];
for (let row = 0; row < 8; row++) for (let col = 0; col < 9; col++) {
const v = 4 + (row >> 1), end = row & 1, side = end ? 1 : -1;
const slope = v === 4 || v === 6 ? -1 : 1, dy = side * slope;
const vertical = col >= 3 && col < 6, belt = col >= 6, spot = col % 3;
const bx = 34 + col * 12, by = 24 + row * 10;
const nx = bx + (spot === 1 ? 0 : side), ny = by + (spot === 0 ? 0 : dy);
const code = belt ? BP_BELT : BP_SCREW;
const straight = belt ? (side > 0 ? 1 : 0) : vertical ? (dy < 0 ? 0 : 2) : (side > 0 ? 1 : 3);
const diagonalCode = belt ? (slope < 0 ? BP_BELT_UP : BP_BELT_DOWN) : BP_SCREW;
const diagonalV = belt ? (SCREW_DIRS[v][0] > 0 ? 1 : 0) : v;
for (let k = 0; k < 2; k++) placeBlock(diagonalCode, diagonalV, bx - k * side, by - k * dy, true);
for (let k = 0; k < 2; k++) placeBlock(code, straight, nx + (vertical ? 0 : k * side * (spot === 1 ? -1 : 1)), ny + (vertical ? k * dy * (spot === 0 ? -1 : 1) : 0), true);
const joined = endJoin(bx, by, end) >= 0;
const kind = joined ? (ny === by ? (end ? 2 : 4) : vertical ? 6 : 5) : 0;
JOIN_CASES.push({v, end, bx, by, nx, ny, vertical, code, straight, joined, kind, spot});
}
updateRoof();
window.CAM = [326, 232];
// Labels are part of the scene so screenshots and browser checks use the same layout.
drawBot = () => {
const ctx = R.ctx;
ctx.save(); ctx.font = '12px monospace'; ctx.textBaseline = 'bottom';
for (const j of JOIN_CASES) {
const p = worldToScreenPx(j.bx * BS - 8, j.by * BS - 14);
ctx.fillStyle = '#17222c';
const name = ['UR', 'DR', 'DL', 'UL'][j.v - 4], axis = j.code === BP_BELT ? 'belt' : j.vertical ? 'V' : 'H';
ctx.fillText(`${name} ${j.end ? 'R' : 'L'} ${axis} ${['side', 'up/down', 'E'][j.spot]}: ${j.joined ? 'JOIN' : 'free'}`, p.x, p.y);
}
ctx.restore();
};