{"tool":"voxel.exec","input":{"code":"function wheel(FWD, cx, cy, cz, r, w, type, hub) {\n  for (var a = -r; a <= r; a++) for (var b = -r; b <= r; b++) {\n    if (a * a + b * b > r * r + r) continue;\n    if (r >= 5 && a * a + b * b < (r - 2) * (r - 2) && a !== 0 && b !== 0 && Math.abs(a) !== Math.abs(b)) continue;\n    for (var t = 0; t < w; t++) {\n      if (FWD === \"z\") block(cx + t, cy + b, cz + a, type);\n      else block(cx + a, cy + b, cz + t, type);\n    }\n  }\n  if (hub) block(FWD === \"z\" ? cx - 1 : cx, cy, FWD === \"z\" ? cz : cz - 1, hub);\n}\n\nfunction cylinder(cx, cy, cz, r, type) {\n  for (var x = cx - r; x <= cx + r; x++) {\n    for (var y = cy - r; y <= cy + r; y++) {\n      for (var z = cz - r; z <= cz + r; z++) {\n        var dx = x - cx, dy = y - cy, dz = z - cz;\n        if (dx * dx + dy * dy + dz * dz <= r * r) block(x, y, z, type);\n      }\n    }\n  }\n}\n\nfunction hollowCylinder(cx, cy, cz, rOuter, rInner, h, type) {\n  for (var x = cx - rOuter; x <= cx + rOuter; x++) {\n    for (var y = cy - rOuter; y <= cy + rOuter; y++) {\n      for (var z = cz - rOuter; z <= cz + rOuter; z++) {\n        var dx = x - cx, dy = y - cy, dz = z - cz;\n        var d2 = dx * dx + dy * dy + dz * dz;\n        if (d2 <= rOuter * rOuter && d2 > rInner * rInner) block(x, y, z, type);\n      }\n    }\n  }\n}\n\nfunction buildLocomotive() {\n  // === BOILER ===\n  box(80, 9, 128, 145, 9, 152, \"iron_block\");\n  cylinder(110, 16, 140, 8, \"iron_block\");\n\n  // === RED STRIPE ===\n  box(103, 24, 140, 117, 24, 140, \"red_wool\");\n  box(106, 25, 140, 114, 25, 140, \"red_wool\");\n\n  // === SMOKESTACK — sits on front of boiler ===\n  // Boiler front edge: x=102, top: y=24\n  cylinder(100, 28, 140, 4, \"iron_block\");\n  // Flue tubes from smokestack base down through boiler\n  box(99, 24, 139, 99, 39, 141, \"iron_block\");\n  box(101, 24, 139, 101, 39, 141, \"iron_block\");\n  box(99, 24, 143, 99, 39, 145, \"iron_block\");\n  box(101, 24, 143, 101, 39, 145, \"iron_block\");\n  // Horizontal flue: smokestack to boiler center\n  line(100, 24, 140, 102, 24, 140, \"iron_block\");\n  // Drop flue from smokestack to boiler cylinder\n  line(100, 24, 140, 100, 16, 140, \"iron_block\");\n  // Chimney cap — sits on smokestack wall (y=24-32)\n  box(95, 33, 134, 105, 34, 146, \"iron_block\");\n  box(97, 34, 136, 103, 34, 144, \"black_wool\");\n\n  // === DOME ===\n  box(105, 24, 136, 115, 27, 144, \"iron_block\");\n  box(107, 28, 138, 113, 28, 142, \"iron_block\");\n\n  // === HEADLIGHT + PIPE ===\n  line(72, 14, 140, 102, 14, 140, \"iron_block\")\n  box(78, 13, 137, 78, 17, 143, \"gold_block\");\n  box(76, 13, 137, 76, 17, 143, \"glass\");\n  box(75, 11, 140, 75, 11, 140, \"glowstone\");\n\n  // === COWCATCHER ===\n  box(45, 4, 131, 72, 8, 149, \"iron_block\");\n  box(45, 4, 131, 45, 8, 149, \"iron_block\");\n  line(45, 8, 131, 68, 4, 131, \"iron_block\");\n  line(45, 8, 149, 68, 4, 149, \"iron_block\");\n  line(45, 6, 131, 65, 4, 140, \"iron_block\");\n  line(45, 6, 149, 65, 4, 140, \"iron_block\");\n\n  // === RUNNING BOARD ===\n  box(72, 7, 130, 145, 7, 134, \"oak_planks\");\n  box(72, 7, 146, 145, 7, 150, \"oak_planks\");\n\n  // === CHIMNEY BASE RING ===\n  box(94, 35, 134, 106, 35, 146, \"gold_block\");\n\n  // === UNDERCARRIAGE FRAME ===\n  box(72, 5, 126, 145, 5, 128, \"iron_block\");\n  box(72, 5, 152, 145, 5, 154, \"iron_block\");\n  box(72, 5, 126, 72, 5, 154, \"iron_block\");\n  box(145, 5, 126, 145, 5, 154, \"iron_block\");\n  for (var x = 75; x <= 142; x += 8) {\n    box(x, 5, 126, x, 5, 154, \"iron_block\");\n  }\n\n  // === VERTICAL SUPPORTS: undercarriage(y=5) to floor(y=8) ===\n  box(72, 6, 126, 72, 7, 154, \"iron_block\");\n  box(145, 6, 126, 145, 7, 154, \"iron_block\");\n  box(72, 6, 126, 145, 6, 126, \"iron_block\");\n  box(72, 6, 154, 145, 6, 154, \"iron_block\");\n\n  // === LEGS: undercarriage(y=5) down to rails(y=3) ===\n  for (var x = 72; x <= 145; x += 12) {\n    box(x, 3, 126, x, 4, 128, \"iron_block\");\n    box(x, 3, 152, x, 4, 154, \"iron_block\");\n  }\n\n  // === CONNECTING RODS ===\n  line(72, 7, 140, 145, 7, 140, \"iron_block\");\n  line(72, 7, 140, 145, 7, 140, \"gold_block\");\n\n  // === CAB ===\n  box(150, 8, 120, 185, 8, 155, \"oak_planks\");\n  box(150, 9, 120, 150, 22, 155, \"oak_planks\");\n  box(185, 9, 120, 185, 22, 155, \"oak_planks\");\n  box(150, 9, 155, 185, 22, 155, \"oak_planks\");\n  for (var x = 152; x <= 183; x++) {\n    for (var z = 122; z <= 153; z++) {\n      if (z >= 130 && z <= 140) continue;\n      block(x, 14, z, \"white_wool\");\n      block(x, 15, z, \"white_wool\");\n      block(x, 16, z, \"white_wool\");\n      block(x, 17, z, \"white_wool\");\n    }\n  }\n  box(150, 23, 120, 185, 23, 155, \"red_wool\");\n  box(152, 24, 120, 183, 24, 155, \"red_wool\");\n\n  // === CAB INTERIOR ===\n  box(155, 9, 125, 180, 9, 150, \"brown_wool\");\n  box(155, 10, 125, 155, 20, 150, \"oak_log\");\n  box(180, 10, 125, 180, 20, 150, \"oak_log\");\n\n  // === CAB DOOR ===\n  box(186, 10, 135, 186, 21, 142, \"oak_planks\");\n  box(186, 15, 138, 186, 15, 139, \"gold_block\");\n\n  // === WHISTLE ===\n  line(110, 25, 135, 110, 30, 135, \"iron_block\");\n  line(110, 30, 135, 115, 30, 135, \"iron_block\");\n  box(114, 29, 134, 116, 31, 136, \"gold_block\");\n\n  // === HANDRAILS ===\n  line(145, 10, 128, 75, 10, 128, \"iron_block\");\n  line(145, 10, 152, 75, 10, 152, \"iron_block\");\n  line(145, 10, 128, 145, 10, 152, \"iron_block\");\n  line(75, 10, 128, 75, 10, 152, \"iron_block\");\n  for (var z = 128; z <= 152; z += 6) line(145, 10, z, 75, 10, z, \"iron_block\");\n}\n\nfunction buildTender() {\n  box(192, 8, 128, 225, 8, 152, \"oak_planks\");\n  box(192, 9, 128, 192, 18, 152, \"oak_planks\");\n  box(225, 9, 128, 225, 18, 152, \"oak_planks\");\n  box(192, 9, 152, 225, 18, 152, \"oak_planks\");\n  for (var x = 194; x <= 223; x++) {\n    for (var z = 130; z <= 150; z++) {\n      block(x, 10, z, \"brown_wool\");\n      block(x, 11, z, \"brown_wool\");\n      block(x, 12, z, \"brown_wool\");\n    }\n  }\n  box(192, 13, 128, 225, 13, 152, \"oak_planks\");\n  box(194, 14, 128, 223, 14, 152, \"oak_planks\");\n\n  // === UNDERCARRIAGE ===\n  box(192, 5, 126, 225, 5, 128, \"iron_block\");\n  box(192, 5, 152, 225, 5, 154, \"iron_block\");\n  box(192, 5, 126, 192, 5, 154, \"iron_block\");\n  box(225, 5, 126, 225, 5, 154, \"iron_block\");\n  for (var x = 196; x <= 221; x += 7) {\n    box(x, 5, 126, x, 5, 154, \"iron_block\");\n  }\n\n  // === VERTICAL SUPPORTS ===\n  box(192, 6, 126, 192, 7, 154, \"iron_block\");\n  box(225, 6, 126, 225, 7, 154, \"iron_block\");\n  box(192, 6, 126, 225, 6, 126, \"iron_block\");\n  box(192, 6, 154, 225, 6, 154, \"iron_block\");\n\n  // === LEGS: undercarriage(y=5) down to rails(y=3) ===\n  for (var x = 192; x <= 225; x += 12) {\n    box(x, 3, 126, x, 4, 128, \"iron_block\");\n    box(x, 3, 152, x, 4, 154, \"iron_block\");\n  }\n\n  // === COUPLING ===\n  line(188, 9, 140, 191, 9, 140, \"iron_block\");\n  box(186, 8, 138, 188, 10, 142, \"iron_block\");\n}\n\nfunction buildPassengerCar() {\n  // Moved back to avoid x>255 (wheels at cx=224/236/242/248, r=2, max x=250)\n  box(215, 8, 127, 245, 8, 153, \"brown_wool\");\n  box(215, 9, 127, 215, 22, 153, \"brown_wool\");\n  box(245, 9, 127, 245, 22, 153, \"brown_wool\");\n  box(215, 9, 153, 245, 22, 153, \"brown_wool\");\n  box(215, 9, 127, 245, 9, 127, \"brown_wool\");\n  box(215, 9, 153, 245, 9, 153, \"brown_wool\");\n\n  // Window pillars (brown_wool filler between window columns)\n  for (var x = 216; x <= 244; x++) {\n    if ((x - 217) % 4 === 0) continue; // skip window positions\n    for (var z = 129; z <= 151; z++) {\n      block(x, 14, z, \"brown_wool\");\n      block(x, 15, z, \"brown_wool\");\n      block(x, 16, z, \"brown_wool\");\n      block(x, 17, z, \"brown_wool\");\n    }\n  }\n  // Windows\n  for (var x = 217; x <= 243; x += 4) {\n    for (var z = 129; z <= 151; z++) {\n      block(x, 14, z, \"blue_wool\");\n      block(x, 15, z, \"blue_wool\");\n      block(x, 16, z, \"blue_wool\");\n      block(x, 17, z, \"blue_wool\");\n    }\n  }\n\n  // Roof\n  box(213, 23, 125, 247, 23, 155, \"gray_wool\");\n  box(214, 24, 126, 246, 24, 154, \"gray_wool\");\n\n  // === UNDERCARRIAGE ===\n  box(215, 5, 126, 245, 5, 128, \"iron_block\");\n  box(215, 5, 152, 245, 5, 154, \"iron_block\");\n  box(215, 5, 126, 215, 5, 154, \"iron_block\");\n  box(245, 5, 126, 245, 5, 154, \"iron_block\");\n  for (var x = 219; x <= 241; x += 6) {\n    box(x, 5, 126, x, 5, 154, \"iron_block\");\n  }\n\n  // === VERTICAL SUPPORTS ===\n  box(215, 6, 126, 215, 7, 154, \"iron_block\");\n  box(245, 6, 126, 245, 7, 154, \"iron_block\");\n  box(215, 6, 126, 245, 6, 126, \"iron_block\");\n  box(215, 6, 154, 245, 6, 154, \"iron_block\");\n\n  // === LEGS: undercarriage(y=5) down to rails(y=3) ===\n  for (var x = 215; x <= 245; x += 12) {\n    box(x, 3, 126, x, 4, 128, \"iron_block\");\n    box(x, 3, 152, x, 4, 154, \"iron_block\");\n  }\n\n  // === COUPLING ===\n  line(213, 9, 140, 214, 9, 140, \"iron_block\");\n  box(210, 8, 138, 212, 10, 142, \"iron_block\");\n}\n\nfunction buildTrackBed() {\n  box(30, 0, 122, 260, 0, 132, \"grass_block\");\n  box(30, 1, 124, 260, 1, 130, \"dirt\");\n  box(30, 2, 125, 260, 2, 129, \"dirt\");\n\n  // Gravel ballast\n  box(30, 1, 118, 260, 1, 119, \"cobblestone\");\n  box(30, 1, 135, 260, 1, 136, \"cobblestone\");\n\n  // Rails\n  box(30, 3, 120, 260, 3, 120, \"iron_block\");\n  box(30, 3, 132, 260, 3, 132, \"iron_block\");\n\n  // Ties\n  for (var x = 30; x <= 260; x += 3) {\n    box(x, 2, 117, x, 2, 135, \"oak_planks\");\n  }\n}\n\nfunction buildStation() {\n  // Platform\n  box(30, 3, 155, 80, 3, 200, \"cobblestone\");\n  box(30, 4, 155, 80, 4, 200, \"stone_bricks\");\n\n  // Platform supports down to ground\n  for (var x = 30; x <= 80; x += 10) {\n    box(x, 0, 155, x, 2, 157, \"stone_bricks\");\n    box(x, 0, 198, x, 2, 200, \"stone_bricks\");\n  }\n  for (var z = 155; z <= 200; z += 12) {\n    box(30, 0, z, 32, 2, z, \"stone_bricks\");\n    box(78, 0, z, 80, 2, z, \"stone_bricks\");\n  }\n\n  // Walls\n  box(30, 5, 155, 30, 14, 200, \"stone_bricks\");\n  box(80, 5, 155, 80, 14, 200, \"stone_bricks\");\n  box(30, 5, 200, 80, 14, 200, \"stone_bricks\");\n\n  // Roof\n  box(28, 15, 153, 82, 15, 202, \"oak_planks\");\n  box(29, 16, 154, 81, 16, 201, \"oak_planks\");\n\n  // Roof support pillars\n  box(30, 5, 153, 32, 14, 155, \"stone_bricks\");\n  box(78, 5, 153, 80, 14, 155, \"stone_bricks\");\n  box(30, 5, 198, 32, 14, 200, \"stone_bricks\");\n  box(78, 5, 198, 80, 14, 200, \"stone_bricks\");\n\n  // Sign\n  box(55, 11, 152, 65, 12, 152, \"oak_planks\");\n  box(56, 11, 152, 64, 12, 152, \"gold_block\");\n  // Sign support to station wall (two segments for 6-directional connectivity)\n  line(60, 11, 152, 80, 11, 152, \"oak_planks\");\n  line(80, 11, 152, 80, 11, 155, \"oak_planks\");\n\n  // Benches\n  box(40, 4, 145, 46, 4, 148, \"oak_planks\");\n  box(40, 5, 145, 40, 7, 148, \"oak_planks\");\n  box(46, 5, 145, 46, 7, 148, \"oak_planks\");\n  box(60, 4, 145, 66, 4, 148, \"oak_planks\");\n  box(60, 5, 145, 60, 7, 148, \"oak_planks\");\n  box(66, 5, 145, 66, 7, 148, \"oak_planks\");\n}\n\nfunction buildTree(x, y, z) {\n  box(x, y, z, x, y + 5, z, \"oak_log\");\n  box(x - 2, y + 4, z - 2, x + 2, y + 8, z + 2, \"oak_leaves\");\n  box(x - 1, y + 7, z - 1, x + 1, y + 10, z + 1, \"oak_leaves\");\n}\n\nfunction buildBush(x, y, z) {\n  box(x, y, z, x + 1, y, z + 1, \"oak_leaves\");\n  box(x, y + 1, z, x, y + 1, z + 1, \"oak_leaves\");\n  box(x + 1, y + 1, z, x + 1, y + 1, z + 1, \"oak_leaves\");\n}\n\n// === SCENE ===\nbuildTrackBed();\nbuildLocomotive();\nbuildTender();\nbuildPassengerCar();\nbuildStation();\n\nbuildTree(100, 3, 100);\nbuildTree(130, 3, 95);\nbuildTree(170, 3, 105);\nbuildTree(220, 3, 98);\nbuildTree(60, 3, 108);\n\nbuildBush(90, 3, 110);\nbuildBush(110, 3, 112);\nbuildBush(150, 3, 111);\nbuildBush(190, 3, 109);\nbuildBush(240, 3, 110);\nbuildBush(45, 3, 112);\nbuildBush(70, 3, 108);\n\n// === GROUND UNDER TREES (trees are off the track bed) ===\nbox(55, 0, 103, 65, 2, 113, \"grass_block\");\nbox(95, 0, 98, 105, 2, 108, \"grass_block\");\nbox(125, 0, 93, 135, 2, 103, \"grass_block\");\nbox(165, 0, 103, 175, 2, 113, \"grass_block\");\nbox(215, 0, 96, 225, 2, 106, \"grass_block\");\nbox(40, 0, 107, 50, 2, 117, \"grass_block\");\nbox(65, 0, 103, 75, 2, 113, \"grass_block\");\n// Bush ground\nbox(85, 0, 105, 95, 2, 115, \"grass_block\");\nbox(105, 0, 107, 115, 2, 117, \"grass_block\");\nbox(145, 0, 106, 155, 2, 116, \"grass_block\");\nbox(185, 0, 104, 195, 2, 114, \"grass_block\");\nbox(235, 0, 105, 245, 2, 115, \"grass_block\");\n","gridSize":256,"palette":"simple","seed":123}}