Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("Length:")
- local length = read()
- print("Depth:")
- local depth = read()
- function Turn()
- for i = 1,2 do
- turtle.turnLeft()
- end
- end
- function TurnHalf()
- turtle.turnRight()
- end
- function ChangeY()
- Turn()
- turtle.digDown()
- turtle.down()
- end
- function ChangeYHalf()
- TurnHalf()
- turtle.digDown()
- turtle.down()
- end
- function Branch()
- for i = 1,(length-1) do
- turtle.dig()
- turtle.forward()
- end
- end
- function BranchToLeft()
- turtle.turnLeft()
- turtle.dig()
- turtle.forward()
- turtle.turnLeft()
- Branch()
- end
- function BranchToRight()
- turtle.turnRight()
- turtle.dig()
- turtle.forward()
- turtle.turnRight()
- Branch()
- end
- function Layer()
- if math.fmod(length, 2) ~= 0 then
- Branch()
- for i = 1,((length-1)/2) do
- BranchToRight()
- BranchToLeft()
- end
- else
- Branch()
- for i = 1,((length-2)/2) do
- BranchToRight()
- BranchToLeft()
- end
- BranchToRight()
- end
- end
- for i = 1,(depth-1) do
- Layer()
- if math.fmod(length, 2) ~= 0 then
- ChangeY()
- else
- ChangeYHalf()
- end
- end
- Layer()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement