Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local comp = require("computer")
- -- vsya dlina polya pered robotom
- local vper = 10
- -- vsya shirina polya
- local shir = 5
- function harvest()
- -- Vhod na pole
- robot.forward()
- -- po shirine
- for y=1, (shir-1) do
- -- harvest one line
- robot.useDown()
- robot.useUp()
- robot.suck()
- robot.suck()
- for x=1, (vper-1) do
- robot.forward()
- robot.useDown()
- robot.useUp()
- robot.suck()
- robot.suck()
- end
- -- povorot
- --esli y nechetnoe to
- if y%2 == 1 then
- robot.turnLeft()
- robot.forward()
- robot.turnLeft()
- else
- robot.turnRight()
- robot.forward()
- robot.turnRight()
- end
- end
- -- na posledneij linii
- for x=1, (vper-1) do
- robot.forward()
- robot.useDown()
- robot.useUp()
- robot.suck()
- robot.suck()
- end
- -- vozvrat
- if shir%2 == 1 then
- robot.turnRight()
- while robot.detect()==false do
- robot.forward()
- end
- robot.turnRight()
- while robot.detect()==false do
- robot.forward()
- end
- else
- robot.turnLeft()
- while robot.detect()==false do
- robot.forward()
- end
- robot.turnRight()
- robot.forward()
- end
- end
- function unload()
- for c = 1, 32 do
- robot.select(c)
- robot.drop()
- end
- end
- robot.turnAround()
- end
- while true do
- harvest()
- unload()
- print('sleep')
- -- one hour sleeping
- os.sleep(3600)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement