Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function proxy(componentType)
- local address = component.list(componentType)()
- return address and component.proxy(address) or error("No component " .. componentType)
- end
- local robot, modem, keyboard = proxy("robot"), proxy("modem"), proxy("keyboard")
- local a = 7
- local function sleep(timeout)
- local deadline = computer.uptime() + timeout
- repeat
- computer.pullSignal(deadline - computer.uptime())
- until computer.uptime() >= deadline
- end
- function start()
- modem.open(6791)
- modem.open(7000)
- modem.setWakeMessage('')
- modem.setStrength(50000)
- end
- function isWorking()
- modem.broadcast(7000, 'Фермер3000 работает.')
- end
- function forward()
- for i = 1, a do
- robot.move(3)
- robot.use(0)
- robot.use(4)
- robot.use(5)
- end
- end
- function back()
- for i = 1, a do
- robot.move(2)
- robot.use(0)
- robot.use(4)
- robot.use(5)
- end
- end
- start()
- while true do
- forward()
- back()
- sleep(.5)
- isWorking()
- end
Add Comment
Please, Sign In to add comment