Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local robot = require("robot")
- local os = require("os")
- local lavaInBucket = false;
- function checkFlower(direction)
- print("Checking flower to the", direction)
- if (lavaInBucket == false) then
- result, description = robot.useDown()
- print(result, description)
- lavaInBucket = true
- end
- if (direction == "right") then
- robot.turnRight()
- else
- robot.turnLeft()
- end
- robot.forward()
- robot.forward()
- robot.forward()
- result, description = robot.detectDown()
- print (result, description)
- if (description == "air") then
- result, description = robot.useDown()
- print(result, description)
- lavaInBucket = false
- end
- robot.back()
- robot.back()
- robot.back()
- if (direction == "right") then
- robot.turnLeft()
- else
- robot.turnRight()
- end
- end
- while true do
- checkFlower("right")
- checkFlower("left")
- os.sleep(20)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement