Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local w, l = ...
- function selectBlock()
- c = 2
- while c <= 16 do
- turtle.select(c)
- if turtle.getItemCount() > 0 then
- return true
- end
- c = c + 1
- end
- end
- function goPlace()
- if turtle.getFuelLevel() <= 100 then
- turtle.select(1)
- turtle.refuel(1)
- end
- turtle.forward()
- if turtle.detectDown() == false then
- if turtle.placeDown() == false then
- selectBlock()
- turtle.placeDown()
- end
- end
- end
- function turn(d)
- if d == "forward" then
- turtle.turnRight()
- goPlace()
- turtle.turnRight()
- return "backward"
- end
- if d == "backward" then
- turtle.turnLeft()
- goPlace()
- turtle.turnLeft()
- return "forward"
- end
- end
- function start(d, w, l)
- if d == "forward" then
- turtle.turnLeft()
- turtle.turnLeft()
- while l > 0 do
- goPlace()
- l = l - 1
- end
- else
- goPlace()
- end
- turtle.turnRight()
- while w > 1 do
- goPlace()
- w = w - 1
- end
- turtle.turnRight()
- end
- direction = "forward"
- wc = tonumber(w)
- while wc > 0 do
- lc = tonumber(l)
- while lc > 0 do
- goPlace()
- lc = lc - 1
- end
- wc = wc - 1
- if wc > 0 then
- direction = turn(direction)
- end
- end
- start(direction, tonumber(w), tonumber(l))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement