Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local comp = require("computer")
- local sizeY = 11 -- длинна поля перед роботом
- local sizeX = 11 -- ширина поля - обязательно всегда не четное число
- function harvest()
- robot.up()
- robot.forward()
- for y=1, sizeX do
- robot.useDown()
- robot.suckDown()
- for x=1, (sizeY-1) do
- robot.forward()
- robot.useDown()
- robot.suckDown()
- end
- -- разворот
- if y%2 == 1 then
- robot.turnLeft()
- robot.forward()
- robot.turnLeft()
- else
- robot.turnRight()
- robot.forward()
- robot.turnRight()
- end
- end
- -- возврат
- for y=1, (sizeY-1) do
- robot.forward()
- end
- robot.turnLeft()
- for x=1, (sizeX-1) do
- robot.forward()
- end
- robot.forward()
- robot.turnRight()
- robot.forward()
- robot.turnAround()
- robot.down()
- end
- --выгрузка добра
- function unload()
- robot.turnAround()
- for c = 1, 16 do
- robot.select(c)
- if robot.count() > 0 then
- robot.drop()
- else
- robot.select(1)
- break
- end
- end
- robot.turnLeft()
- robot.up()
- robot.use(3)
- robot.down()
- print("Заряжаюсь")
- for i=1, 10 do
- os.sleep(4)
- -- print("Ожидаю ")
- print("Ожидаю ",(10*i)..'%')
- end
- robot.up()
- robot.use(3)
- robot.down()
- robot.turnLeft()
- end
- while true do
- -- one hour sleeping
- print("Начинаю работу")
- for i=1, 10 do
- os.sleep(50)
- -- print("Ожидаю ")
- print("Ожидаю ",(10*i)..'%')
- end
- --
- harvest()
- unload()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement