Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local lmax,wmax,hmax,d=...
- local l=0
- local h=0
- local w=1
- local f=0
- function Left(lt)
- while lt~=0 do
- turtle.turnLeft()
- lt=lt-1
- end
- end
- function Right(rt)
- while rt~=0 do
- turtle.turnRight()
- rt=rt-1
- end
- end
- function layer()
- turtle.digUp()
- turtle.digDown()
- Right(1)
- turtle.dig()
- Left(2)
- turtle.dig()
- Right(1)
- end
- function down()
- for h=0,hmax do
- layer()
- turtle.digDown()
- turtle.down()
- h=h+1
- end
- end
- function up()
- for h=0,hmax do
- layer()
- turtle.digUp()
- turtle.up()
- h=h+1
- end
- end
- function store()
- turtle.select(1)
- turtle.digUp()
- turtle.placeUp()
- for s=2,16 do
- turtle.select(s)
- turtle.dropUp()
- end
- turtle.select(1)
- turtle.digUp()
- end
- function length()
- while l~=lmax do
- down()
- layer()
- store()
- turtle.dig()
- turtle.forward()
- l=l+1
- up()
- layer()
- store()
- if l~=lmax then
- turtle.dig()
- turtle.forward()
- l=l+1
- end
- end
- end
- function align()
- print("Moving into position")
- print(lmax,':',l,':',wmax,':',w,':',hmax,':',h,':R0L1',direction)
- if d==0 then
- Right(1)
- end
- if d==1 then
- Left(1)
- end
- turtle.forward()
- if d==0 then
- Left(1)
- end
- if d==1 then
- Right(1)
- end
- w=w+1
- end
- function turn()
- f=0
- if d==0 then
- Right(1)
- if w~=wmax-1 then
- turtle.dig()
- turtle.forward()
- w=w+1
- else
- f=f+1
- end
- if w~=wmax-1 then
- turtle.dig()
- turtle.forward()
- w=w+1
- else
- f=f+1
- end
- if w~=wmax-1 then
- turtle.dig()
- turtle.forward()
- w=w+1
- else
- f=f+1
- end
- d=1
- end
- if d==1 then
- Left(1)
- if w~=wmax-1 then
- turtle.dig()
- turtle.forward()
- w=w+1
- else
- f=f+1
- end
- if w~=wmax-1 then
- turtle.dig()
- turtle.forward()
- w=w+1
- else
- f=f+1
- end
- if w~=wmax-1 then
- turtle.dig()
- turtle.forward()
- w=w+1
- else
- f=f+1
- end
- d=0
- end
- end
- align()
- while f~=3 do
- length()
- turn()
- end
Add Comment
Please, Sign In to add comment