Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function turnAround()
- turtle.turnLeft()
- turtle.turnLeft()
- end
- function sandDig()
- while turtle.detect() do
- turtle.dig()
- end
- while turtle.detectUp() do
- turtle.digUp()
- end
- turtle.digDown()
- end
- function forward(n) -- Forward and dig
- for i=1,n do
- sandDig()
- turtle.forward()
- end
- end
- function down(n) -- Down n times
- for i = 1,n do
- turtle.down()
- end
- end
- function digL() -- Dig length
- if l > 0 then
- for i = 1,l-1 do
- sandDig()
- turtle.forward()
- end
- end
- end
- function nextRow()
- if count % 2 == 0 then -- Right for even number rows
- turtle.turnRight()
- sandDig()
- turtle.forward()
- turtle.turnRight()
- else -- Left for odd number rows
- turtle.turnLeft()
- sandDig()
- turtle.forward()
- turtle.turnLeft()
- end
- count = count + 1
- end
- function section()
- for i = 1,w do
- digL() -- Dig out length and move to next rows
- if i < w then -- Won't start extra row at end
- nextRow() -- Digs one whole section
- end
- end
- end
- count = 1 -- For nextRow function
- print("How far forward? (length)")
- l = tonumber(read()) -- Length
- print("How far left? (width)")
- w = tonumber(read()) -- Width
- if h > 0 then
- print("Here I go!")
- goingUp()
- end
- if h > 0 then
- print("Complete.")
- down(h) -- Parks turtle in bottom corner
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement