{"tool":"voxel.exec","input":{"code":"const CZ = 128, RA = 124, RB = 132;\n\nconst ball = (cx, cy, cz, r, t) => {\n  for (let dx = -r; dx <= r; dx++) for (let dy = -r; dy <= r; dy++) for (let dz = -r; dz <= r; dz++)\n    if (dx * dx + dy * dy + dz * dz <= r * r) block(cx + dx, cy + dy, cz + dz, t);\n};\nconst xDisc = (x, cy, cz, r2, t) => {\n  const r = Math.ceil(Math.sqrt(r2));\n  for (let dy = -r; dy <= r; dy++) for (let dz = -r; dz <= r; dz++)\n    if (dy * dy + dz * dz <= r2) block(x, cy + dy, cz + dz, t);\n};\nconst vCyl = (cx, cz, y0, y1, r2, t) => {\n  const r = Math.ceil(Math.sqrt(r2));\n  for (let y = y0; y <= y1; y++) for (let dx = -r; dx <= r; dx++) for (let dz = -r; dz <= r; dz++)\n    if (dx * dx + dz * dz <= r2) block(cx + dx, y, cz + dz, t);\n};\nconst wheel = (x, zc) => {\n  xDisc(x, 7, zc, 9, \"black_wool\");\n  xDisc(x + 1, 7, zc, 9, \"black_wool\");\n  block(x, 7, zc, \"gold_block\");\n  block(x + 1, 7, zc, \"gold_block\");\n};\nconst tree = (tx, tz) => {\n  const h = 4 + Math.floor(rng() * 3), r = 3 + Math.floor(rng() * 2);\n  box(tx, 2, tz, tx, 1 + h, tz, \"oak_log\");\n  for (let dx = -r; dx <= r; dx++) for (let dy = -r + 1; dy <= r; dy++) for (let dz = -r; dz <= r; dz++)\n    if (dx * dx + dy * dy + dz * dz <= r * r + rng() * 2 - 1) block(tx + dx, 1 + h + dy, tz + dz, \"oak_leaves\");\n};\nconst person = (x, z, shirt, pants) => {\n  block(x, 4, z, pants);\n  block(x, 5, z, shirt);\n  block(x, 6, z, \"orange_wool\");\n  block(x, 7, z, \"black_wool\");\n};\n\nconst car = (a, b) => {\n  box(a, 9, 122, b, 9, 134, \"iron_block\");\n  box(a, 10, 123, b, 17, 133, \"red_wool\");\n  for (let dz = -6; dz <= 6; dz++) box(a, 18, CZ + dz, b, 18 + Math.floor(Math.sqrt(42.25 - dz * dz)), CZ + dz, \"gray_wool\");\n  box(a, 11, 122, b, 11, 122, \"gold_block\");\n  box(a, 11, 134, b, 11, 134, \"gold_block\");\n  for (let x = a + 1; x <= b - 1; x++) {\n    if ((x - a) % 4 === 0) {\n      box(x, 10, 122, x, 17, 122, \"red_wool\");\n      box(x, 10, 134, x, 17, 134, \"red_wool\");\n    } else {\n      box(x, 12, 123, x, 16, 123, \"glass\");\n      box(x, 12, 133, x, 16, 133, \"glass\");\n    }\n  }\n  wheel(a + 2, RA); wheel(a + 2, RB);\n  wheel(b - 3, RA); wheel(b - 3, RB);\n};\n\nconst cupola = (cx) => {\n  box(cx - 4, 25, 126, cx + 4, 27, 130, \"red_wool\");\n  box(cx - 3, 26, 126, cx + 3, 26, 126, \"glass\");\n  box(cx - 3, 26, 130, cx + 3, 26, 130, \"glass\");\n  box(cx - 5, 28, 125, cx + 5, 28, 131, \"black_wool\");\n  block(cx, 29, CZ, \"glowstone\");\n};\n\nconst bellows = (g) => {\n  box(g, 8, 127, g, 8, 129, \"iron_block\");\n  box(g, 10, 124, g, 15, 132, \"gray_wool\");\n};\n\nconst tender = (a, b) => {\n  box(a, 9, 122, b, 9, 134, \"iron_block\");\n  box(a, 10, 123, b, 14, 133, \"gray_wool\");\n  box(a, 12, 122, b, 12, 122, \"gold_block\");\n  box(a, 12, 134, b, 12, 134, \"gold_block\");\n  const mid = (a + b) / 2;\n  for (let x = a + 1; x <= b - 1; x++) for (let z = 124; z <= 132; z++) {\n    const h = Math.round(3 - Math.abs(x - mid) * 0.4 - Math.abs(z - CZ) * 0.5 + rng() * 0.8);\n    for (let y = 15; y < 15 + h; y++) block(x, y, z, \"black_wool\");\n  }\n  wheel(a + 1, RA); wheel(a + 1, RB);\n  wheel(b - 2, RA); wheel(b - 2, RB);\n};\n\n// ground\nbox(20, 0, 96, 236, 0, 160, \"stone\");\nbox(20, 1, 96, 236, 1, 160, \"grass_block\");\nbox(36, 1, 102, 58, 1, 116, \"sand\");\nbox(38, 1, 104, 56, 1, 114, \"water\");\nfor (let i = 0; i < 18; i++) {\n  const tx = 24 + Math.floor(rng() * 208);\n  const north = rng() < 0.5;\n  const tz = north ? 98 + Math.floor(rng() * 10) : 156 + Math.floor(rng() * 4);\n  if (tx >= 34 && tx <= 60 && tz >= 100 && tz <= 116) continue;\n  tree(tx, tz);\n}\n\n// track bed and rails\nbox(20, 2, 119, 236, 2, 137, \"cobblestone\");\nfor (let x = 20; x <= 236; x += 3) box(x, 2, 121, x, 2, 135, \"oak_planks\");\nbox(20, 3, RA, 236, 3, RA, \"iron_block\");\nbox(20, 3, RB, 236, 3, RB, \"iron_block\");\n\n// signal post\nbox(100, 2, 117, 100, 11, 117, \"oak_log\");\nbox(98, 11, 117, 102, 11, 117, \"red_wool\");\nblock(100, 12, 117, \"glowstone\");\n\n// station platform and canopy\nbox(100, 2, 136, 172, 3, 141, \"stone_bricks\");\nbox(100, 3, 136, 172, 3, 136, \"yellow_wool\");\nfor (const px of [102, 120, 138, 156, 170]) {\n  box(px, 4, 137, px, 8, 137, \"oak_log\");\n  block(px, 8, 139, \"glowstone\");\n}\nbox(100, 9, 135, 172, 9, 142, \"oak_planks\");\n\n// station house\nbox(112, 2, 143, 140, 9, 152, \"bricks\");\nbox(112, 9, 143, 140, 9, 143, \"stone_bricks\");\nbox(112, 9, 152, 140, 9, 152, \"stone_bricks\");\nfor (let z = 143; z <= 152; z++) {\n  const t = Math.min(z - 143, 152 - z);\n  box(112, 10, z, 140, 10 + t, z, \"oak_planks\");\n}\nfor (const wx of [116, 119, 133, 136]) {\n  box(wx, 5, 143, wx + 1, 7, 143, \"glass\");\n  box(wx, 5, 152, wx + 1, 7, 152, \"glass\");\n}\nbox(126, 2, 143, 127, 4, 143, \"oak_planks\");\n\nperson(120, 138, \"red_wool\", \"blue_wool\");\nperson(146, 139, \"white_wool\", \"gray_wool\");\nperson(158, 138, \"green_wool\", \"black_wool\");\nbox(146, 4, 141, 147, 4, 141, \"brown_wool\");\n\n// train, rear to front: caboose, two coaches, tender, locomotive\ncar(66, 88); cupola(77);\nbellows(89);\ncar(90, 112);\nbellows(113);\ncar(114, 136);\nbellows(137);\ntender(138, 150);\nbellows(151);\n\n// locomotive cab\nbox(152, 9, 122, 161, 9, 134, \"iron_block\");\nbox(152, 10, 122, 161, 20, 122, \"green_wool\");\nbox(152, 10, 134, 161, 20, 134, \"green_wool\");\nbox(152, 10, 122, 152, 20, 134, \"green_wool\");\nbox(152, 21, 121, 161, 21, 135, \"black_wool\");\nbox(154, 13, 122, 159, 17, 122, \"glass\");\nbox(154, 13, 134, 159, 17, 134, \"glass\");\nbox(152, 13, 125, 152, 17, 131, \"glass\");\nbox(152, 20, 122, 161, 20, 122, \"gold_block\");\nbox(152, 20, 134, 161, 20, 134, \"gold_block\");\n\n// boiler, bands, dome, sand dome, stack\nfor (let x = 160; x <= 184; x++) xDisc(x, 13, CZ, 30, \"black_wool\");\nxDisc(165, 13, CZ, 31, \"iron_block\");\nxDisc(178, 13, CZ, 31, \"iron_block\");\nfor (let dx = -3; dx <= 3; dx++) for (let dy = 0; dy <= 3; dy++) for (let dz = -3; dz <= 3; dz++)\n  if (dx * dx + dy * dy + dz * dz <= 6) block(170 + dx, 18 + dy, CZ + dz, \"gold_block\");\nfor (let dx = -2; dx <= 2; dx++) for (let dy = 0; dy <= 2; dy++) for (let dz = -2; dz <= 2; dz++)\n  if (dx * dx + dy * dy + dz * dz <= 4) block(176 + dx, 18 + dy, CZ + dz, \"iron_block\");\nvCyl(180, CZ, 19, 23, 2.25, \"black_wool\");\nvCyl(180, CZ, 24, 24, 4, \"iron_block\");\n\n// smokebox, front plate, headlamp, cowcatcher\nfor (let x = 184; x <= 187; x++) xDisc(x, 13, CZ, 20, \"black_wool\");\nxDisc(188, 13, CZ, 20, \"iron_block\");\nblock(189, 13, CZ, \"glowstone\");\nfor (let dy = -1; dy <= 1; dy++) for (let dz = -1; dz <= 1; dz++)\n  if (dy !== 0 || dz !== 0) block(189, 13 + dy, CZ + dz, \"gold_block\");\nfor (let x = 186; x <= 190; x++) {\n  const top = 8 - (x - 186);\n  for (let z = 122; z <= 134; z += 2) box(x, 4, z, x, top, z, \"iron_block\");\n}\n\n// drivers and side rods\nwheel(167, RA); wheel(167, RB);\nwheel(173, RA); wheel(173, RB);\nwheel(179, RA); wheel(179, RB);\nbox(167, 7, 120, 180, 7, 120, \"iron_block\");\nbox(167, 7, 136, 180, 7, 136, \"iron_block\");\n\n// steam\nfor (let i = 0; i < 14; i++) {\n  const cx = Math.round(181 - i * 2.6 + rng() * 2);\n  const cy = Math.round(27 + i * 1.3 + rng() * 1.5);\n  const cz = CZ + Math.round(rng() * 2 - 1);\n  ball(cx, cy, cz, Math.round(1.5 + i * 0.35), i % 3 === 0 ? \"gray_wool\" : \"white_wool\");\n}\n","gridSize":256,"palette":"simple","seed":123}}