Please make sure the turtle mines a 3x3 in front of it, as if its placed on the left corner of it. And it has to be able to mine upwards, so it can move upwards, even if it is blocked.
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Here’s a self-contained ComputerCraft turtle program that will dig a 3×3 vertical shaft of height 25, starting from the bottom-left corner of that shaft. It will:
• carve out each 3×3 “layer”
• climb up one block (digging out any obstruction)
• repeat 25 times
• then climb back down (digging if needed) to its exact start position and orientation
lua
-- CONFIGURATION
local SHAFT_WIDTH = 3 -- X-axis size
local SHAFT_DEPTH = 3 -- Z-axis size
local SHAFT_HEIGHT = 25 -- Y-axis size
-- SAFE MOVEMENT: keep digging until you can move
local function upSafe()
while not turtle.up() do
turtle.digUp()
sleep(0.2)
end
end
local function downSafe()
while not turtle.down() do
turtle.digDown()
sleep(0.2)
end
end
-- DIG ONE 3×3 LAYER in front of the turtle,
-- starting from its current "bottom-left" corner.
-- At the end, the turtle will be back at that corner
-- facing the same direction it started.
local function digLayer()
for row = 1, SHAFT_WIDTH do
-- dig across the "depth" of the shaft
for col = 1, SHAFT_DEPTH do
turtle.dig() -- clear block in front
turtle.digUp() -- clear block above
if col < SHAFT_DEPTH then
turtle.forward()
end
end
-- move to next row (zig-zag)
if row < SHAFT_WIDTH then
if row % 2 == 1 then
turtle.turnRight()
turtle.dig()
turtle.turnRight()
else
turtle.turnLeft()
turtle.dig()
turtle.turnLeft()
end
end
end
-- RETURN to bottom-left corner of this layer
-- (we end on the far side after finishing the zig-zag)
if SHAFT_WIDTH % 2 == 1 then
-- odd number of rows → we're facing same way we started
-- so just backtrack on the depth axis, then width axis
turtle.turnRight()
for i = 1, SHAFT_DEPTH - 1 do turtle.forward() end
turtle.turnRight()
for i = 1, SHAFT_WIDTH - 1 do turtle.forward() end
turtle.turnRight()
turtle.turnRight()
else
-- even number of rows → we ended flipped
-- so backtrack width first, then depth
for i = 1, SHAFT_WIDTH - 1 do turtle.back() end
turtle.turnLeft()
for i = 1, SHAFT_DEPTH - 1 do turtle.forward() end
turtle.turnLeft()
end
end
-- MAIN ROUTINE
local function main()
print("Starting 3×3 up-shaft of height", SHAFT_HEIGHT)
-- dig each layer, then climb up
for h = 1, SHAFT_HEIGHT do
digLayer()
upSafe()
print(" → dug layer", h, "of", SHAFT_HEIGHT)
end
-- now at top; climb back down
for h = 1, SHAFT_HEIGHT do
downSafe()
end
print("Done! Returned to start.")
end
-- RUN!
main()
How it works:
digLayer()
– Zig-zags through a 3×3 square in front of the turtle, digging front & up
– At the end it backtracks to the original corner and orientation
upSafe()
– Before moving up, it keeps diggingUp() until the way is clear
Repeat 1+2 for SHAFT_HEIGHT levels
Go back downSafe() the same number of times (digging if needed)
Just paste this into a file (e.g. edit mine3x3up), put enough fuel in slot 1 (and keep an eye on your inventory!), then run mine3x3up. The turtle will carve out your 3×3 vertical shaft and return home. 🚀