Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- robot = require("robot")
- function main()
- while true do
- local _, isWood = robot.detect()
- if isWood == "solid" then
- jack()
- plant()
- end
- os.sleep(30)
- suck()
- end
- end
- function jack()
- while robot.detect() do
- robot.swing()
- robot.swingUp()
- robot.up()
- end
- while not robot.detectDown() do
- robot.down()
- end
- end
- function plant()
- robot.place()
- end
- function suck()
- robot.turnRight()
- for i = 0, 3 do
- robot.forward()
- robot.turnLeft()
- robot.forward()
- rotate()
- end
- robot.turnLeft()
- end
- function rotate()
- for i = 0, 3 do
- robot.suck()
- robot.turnRight()
- end
- end
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement