Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component=require("component")
- local robot=require("robot")
- function treelogic()
- logic = robot.compare()
- if logic == false then
- robot.swing(forward, 10)
- robot.swing(up, 10)
- moveforward(1)
- robot.suck()
- robot.turnLeft()
- moveforward(1)
- robot.turnLeft()
- moveforward(1)
- robot.turnLeft()
- moveforward(2)
- robot.turnLeft()
- moveforward(2)
- robot.turnLeft()
- moveforward(1)
- robot.turnLeft()
- robot.suck()
- robot.place()
- robot.turnAround()
- else
- robot.suck()
- robot.turnLeft()
- robot.forward()
- robot.turnRight()
- moveforward(2)
- robot.turnRight()
- moveforward(1)
- robot.turnLeft()
- end
- end
- function moveforward(n)
- for i=1,n do
- robot.suck()
- robot.turnRight()
- robot.suck()
- robot.turnLeft()
- robot.forward()
- end
- end
- function iloop()
- while true do
- robot.turnLeft()
- moveforward(3)
- robot.turnRight()
- moveforward(2)
- treelogic()
- moveforward(3)
- treelogic()
- moveforward(3)
- treelogic()
- robot.turnLeft()
- moveforward(5)
- robot.turnLeft()
- treelogic()
- moveforward(3)
- treelogic()
- moveforward(3)
- treelogic()
- robot.turnRight()
- moveforward(5)
- robot.turnRight()
- treelogic()
- moveforward(3)
- treelogic()
- moveforward(3)
- treelogic()
- moveforward(2)
- robot.turnRight()
- moveforward(13)
- robot.turnRight()
- moveforward(16)
- robot.turnLeft()
- robot.select(2)
- int = robot.count(2) - 1
- component.generator.insert(int)
- print("Generator Fuel: " .. component.generator.count())
- total = 0
- total2 = 0
- for i=2,16 do
- robot.select(i)
- items = robot.count(i)
- itemstodrop = items - 1
- robot.drop(itemstodrop)
- total = total2 + itemstodrop
- end
- print(total2 .. " logs collected after fueling")
- robot.turnLeft()
- robot.select(1)
- print("-----------------------------------------")
- os.sleep(5*60)
- end
- end
- iloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement