Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Please enter width: ")
- local width = tonumber(read())
- print("Please enter height: ")
- local height = tonumber(read())
- print("Please enter depth: ")
- local depth = tonumber(read())
- width = math.max(1, width)
- if (width % 2 == 0) then
- width = width + 1
- end
- height = math.max(1, height)
- depth = math.max(1, depth)
- local yDir = "up"
- local dir = 0
- function turnLeft()
- dir = (dir + 3 % 4)
- turtle.turnLeft()
- end
- function turnRight()
- dir = (dir + 1) % 4
- turtle.turnRight()
- end
- turtle.dig()
- turtle.forward()
- turnLeft()
- for x=1, (width - 1) / 2 do
- turtle.dig()
- turtle.forward()
- end
- turnRight()
- turnRight()
- for z=1, depth do
- for y=1, height do
- for x=1, width - 1 do
- turtle.dig()
- turtle.forward()
- end
- turnRight()
- turnRight()
- if y < height then
- if yDir == "up" then
- turtle.digUp()
- turtle.up()
- elseif yDir == "down" then
- turtle.digDown()
- turtle.down()
- end
- end
- end
- if yDir == "up" then
- yDir = "down"
- elseif yDir == "down" then
- yDir = "up"
- end
- if z < depth then
- local inwardDir = dir
- if dir == 1 then
- turnLeft()
- elseif dir == 3 then
- turnRight()
- end
- turtle.dig()
- turtle.forward()
- if inwardDir == 1 then
- turnRight()
- elseif inwardDir == 3 then
- turnLeft()
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement