Deepgrain Foundry: move from a claude.ai artifact to a local repository

The game as of artifact version 24, ready for local development with
coding agents.

- Source split from three large files into 52 small ones under src/sim,
  src/render and src/ui, joined in the order in src/manifest.json by
  build.py. The joined code is unchanged apart from comments; every
  headless suite gives the same output, and screenshots in both looks
  are pixel-identical to before.
- Light tidying with no change in behaviour: one movement scan loop,
  shared hazard-stripe and belt shader helpers, unused code removed, a
  shared check helper for the test suites.
- World files can be exported as an ordinary download outside claude.ai.
- Tests: broken old scripts removed, experiments moved to tools/,
  test/run_all.py added. Tools: shot.py (repeatable screenshots),
  where.py, map.py.
- Docs: AGENTS.md, CLAUDE.md, NOTES.md (the owner's to-do inbox),
  docs/PROJECT_MAP.md, DESIGN.md, TESTING.md, systems notes, the
  owner's requests and an agent log.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01K9kLmYADKSEjuwUN3rFxDA
This commit is contained in:
2026-10-23 16:05:31 -04:00
co-authored by Claude Opus 5.5
commit b270c4e818
97 changed files with 11710 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
// A clear work area left of the bot's starting point (the trade dock is to its right): open
// sky 160 grains wide and 40 tall, over a flat stone floor. Money and a bag of building
// stuff to build with. Sets FLOOR (the first row of the floor), BX, BY (the leftmost block
// of the area that stands on the floor) and CAM (the middle of the area).
money = 50000;
const x0 = Math.max(4, SX - 170), x1 = SX - 10, y0 = SY - 40;
window.FLOOR = SY + 40;
for (let y = y0; y < FLOOR + 8; y++) for (let x = x0; x < x1; x++) {
const i = y * W + x;
bgm[i] = 0;
setCell(i, y >= FLOOR ? STONE : EMPTY, AMB[y], y >= FLOOR ? F_NAT : 0);
}
// open sky down to the floor (the renderer draws cave wall behind empty cells below surfY)
for (let x = x0; x < x1; x++) { surfY[x] = FLOOR; dirtY[x] = Math.max(dirtY[x], FLOOR + 8); }
updateRoof();
window.BX = Math.ceil(x0 / 4) + 1; window.BY = Math.floor(FLOOR / 4) - 1;
bag[RSTONE] = 400; bag[RBRICK] = 200; bagTotal = 600;
window.CAM = [(x0 + x1) / 2, SY + 20];
+14
View File
@@ -0,0 +1,14 @@
// The stone and sand machines: a half-full silo with its gate open over a belt, a stone cutter
// fed with rubble, and cut stone and glass brick walls. Run clear-sky.js first, e.g.
// python3 tools/shot.py /tmp/stone.png --setup tools/scenes/clear-sky.js --js "$(cat tools/scenes/stone-uses.js)" --ticks 240 --zoom 7
const bx = BX + 1, by = BY - 7; // the silo is 6 blocks tall; its gate pours onto a belt a block below
placeMachineAt('silo', 0, bx, by);
const silo = machines.find(m => m && m.type === 'silo'); silo.sm = RSTONE; silo.sn = 2300; silo.open = true;
for (let k = bx - 2; k <= bx + 10; k++) placeBlock(BP_BELT, 1, k, BY, true);
placeMachineAt('cutter', 0, bx + 14, BY - 3);
for (let k = bx + 12; k <= bx + 22; k++) placeBlock(BP_BELT, 1, k, BY - 1, true);
for (let y = (BY - 3) * 4; y < (BY - 3) * 4 + 5; y++) for (let x = (bx + 14) * 4 + 2; x < (bx + 14) * 4 + 6; x++) setCell(y * W + x, RSTONE, AMB[y], 0);
bag[BARSB] = 40; bag[BARGL] = 20; bagTotal += 60;
for (let k = 0; k < 4; k++) for (let j = 0; j < 3; j++) placeBlock(BP_WALL, BARSB, bx + 26 + k, BY - j, false);
for (let k = 0; k < 2; k++) placeBlock(BP_WALL, BARGL, bx + 31 + k, BY, false);
window.CAM = [(bx + 16) * 4, (BY - 4) * 4];