Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shouldGoLeft = true
- loops = 0
- print("starting in 10 seconds")
- sleep(10)
- function turnLeft()
- turtle.turnLeft()
- turtle.forward()
- turtle.turnLeft()
- end
- function turnRight()
- turtle.turnRight()
- turtle.forward()
- turtle.turnRight()
- end
- function isGrown(blockInfo)
- return blockInfo.state.age == 3
- end
- function goHome()
- print("going home")
- turtle.turnLeft()
- i = 0
- while (i < 17) do
- i = i + 1
- turtle.forward()
- end
- turtle.turnLeft()
- print("sleeping...")
- sleep(600)
- print("starting!")
- loops = 0
- shouldGoLeft = true
- end
- function placeSeeds()
- digged, reason = turtle.digDown()
- if (digged == false) then
- print(reason)
- end
- placed, reason = turtle.placeDown()
- if (placed == false) then
- print(reason)
- end
- while (true) do
- pickedUp, _ = turtle.suckDown()
- if (pickedUp == false) then
- break
- end
- end
- end
- function farmBlock()
- hasBlock, blockInfo = turtle.inspectDown()
- if hasBlock then
- if isGrown(blockInfo) then
- placeSeeds()
- end
- else
- placeSeeds()
- end
- end
- while (true) do
- i = 0
- while (i < 9) do
- turtle.forward()
- farmBlock()
- i = i+1
- end
- loops = loops + 1
- if (loops == 18) then
- goHome()
- elseif (shouldGoLeft) then
- shouldGoLeft = false
- turnLeft()
- else
- shouldGoLeft = true
- turnRight()
- end
- end
Add Comment
Please, Sign In to add comment