Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local comp = require("computer")
- local size = 9
- function harvest()
- -- fly to start
- robot.forward()
- for y=1, size do
- -- harvest one line
- robot.swingDown()
- robot.useDown()
- robot.placeDown()
- for x=1, (size-1) do
- robot.forward()
- robot.swingDown()
- robot.useDown()
- robot.placeDown()
- end
- -- turn
- if y%2 == 1 then
- robot.turnLeft()
- robot.forward()
- robot.turnLeft()
- else
- robot.turnRight()
- robot.forward()
- robot.turnRight()
- end
- end
- -- return
- for y=1, (size-1) do
- robot.forward()
- end
- robot.turnLeft()
- for y=1, (size) do
- robot.forward()
- end
- robot.turnRight()
- robot.forward()
- robot.turnAround()
- end
- function unload()
- robot.turnAround()
- for c = 2, 16 do
- robot.select(c)
- if robot.count() > 0 then
- robot.drop()
- else
- robot.select(1)
- break
- end
- end
- robot.turnAround()
- end
- while true do
- harvest()
- if robot.count(2) == 64 then
- unload()
- end
- -- one hour sleeping
- for i=1, 100 do
- os.sleep(36)
- print((1*i)..'%')
- end
- --
- end
Advertisement
Add Comment
Please, Sign In to add comment