Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local rb = require("robot")
- local function mine(times)
- a, b = rb.detect()
- rb.select(1)
- for i=1, times do
- if a == true then
- rb.swing()
- print("front of robot: " .. b)
- end
- rb.forward()
- print("Was done attempt:", i)
- end
- os.execute("clear")
- end
- local function howmanydidimined()
- rb.select(2)
- col = rb.count()
- print("I mined",col)
- end
- local function goback(times)
- rb.turnAround()
- for i=1, times do
- rb.forward()
- end
- rb.dropUp()
- rb.turnAround()
- end
- os.execute("clear")
- print("Enter mining times")
- local input = io.read()
- mine(input)
- howmanydidimined()
- goback(input)
- print("I stopped my work")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement