Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local width = 7
- local length = 12
- local startLeft = true
- local function farmSquare(w, l, left)
- local turnLeft = not left
- local slot = 1
- turtle.select(slot)
- for x = 1, w do
- for y = 1, l do
- turtle.digDown()
- turtle.digDown()
- turtle.placeDown()
- if turtle.getItemCount(slot) == 0 then
- slot = slot + 1
- turtle.select(slot)
- end
- if y ~= l then
- turtle.forward()
- end
- end
- if x ~= w then
- if turnLeft then
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- turnLeft = false
- else
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- turnLeft = true
- end
- else
- if left then
- turtle.turnLeft()
- else
- turtle.turnRight()
- end
- for i = 1, (w - 1) do
- turtle.forward()
- end
- if left then
- turtle.turnRight()
- else
- turtle.turnLeft()
- end
- for i = 1, (l - 1) do
- turtle.back()
- end
- end
- end
- end
- print('starting')
- farmSquare(width, length, startLeft)
- print('finished')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement