length = 3
width = 3
function pivotLeft ()
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
end
function pivotRight ()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
end
turtle.turnLeft()
while true do
x = 0
if turtle.getFuelAmount() < length * width then
turtle.refuel()
turtle.digDown()
turtle.down()
while x < length do
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
if x % 2 == 0 then
pivotLeft()
else
pivotRight()
end
x = x + 1
end
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
x = 0
turtle.turnRight()
turtle.turnRight()
turtle.digDown()
turtle.down()
while x < length do
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
if x % 2 == 0 then
pivotRight()
else
pivotLeft()
end
x = x + 1
end
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
turtle.turnRight()
turtle.turnRight()
end
width = 3
function pivotLeft ()
turtle.turnLeft()
turtle.dig()
turtle.forward()
turtle.turnLeft()
end
function pivotRight ()
turtle.turnRight()
turtle.dig()
turtle.forward()
turtle.turnRight()
end
turtle.turnLeft()
while true do
x = 0
if turtle.getFuelAmount() < length * width then
turtle.refuel()
turtle.digDown()
turtle.down()
while x < length do
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
if x % 2 == 0 then
pivotLeft()
else
pivotRight()
end
x = x + 1
end
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
x = 0
turtle.turnRight()
turtle.turnRight()
turtle.digDown()
turtle.down()
while x < length do
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
if x % 2 == 0 then
pivotRight()
else
pivotLeft()
end
x = x + 1
end
z = 0
while z < width do
turtle.dig()
turtle.forward()
z = z + 1
end
turtle.turnRight()
turtle.turnRight()
end