Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- 1/6/13 Maxiride
- -- tflat v1.1
- function fw() -- Forward function to avoid glitches with gravel falling down
- while turtle.detect() do
- turtle.dig()
- end
- turtle.forward()
- end
- function tr() -- Turn right function and 1 step fotward
- turtle.turnRight()
- fw()
- turtle.turnRight()
- end
- function tl() -- Turn left function and 1 step forward
- turtle.turnLeft()
- fw()
- turtle.turnLeft()
- end
- function up()
- if turtle.detectUp() then
- turtle.digUp()
- end
- turtle.up()
- if o==0 then
- turtle.turnLeft()
- turtle.turnLeft()
- up()
- else
- turtle.turnRight()
- turtle.turnRight()
- up()
- end
- end
- function main()
- turtle.refuel()
- print ("Insert Lenght of the cleaning path (in front of the turtle)")
- len=read()
- print("Insert Width of the cleaning path (on the right side of the turtle)")
- wid=read()
- print ("Insert Height of the cleaning path (on top of the turtle)")
- hei=read()
- local o=0 -- Counter 1-0 for tr() or tf()
- for i=1, hei do
- for j=1, wid do
- for k=1, len do
- fw()
- print("fw",k)
- end
- print(o)
- if (o==0 and (not(j==wid))) then
- tr()
- o=o+1
- elseif (o==1 (not(j==wid))) then
- tl()
- o=o-1
- else
- up()
- end
- print("wid",j)
- end
- print("Up!",i)
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment