Advertisement
ecco7777

random moving mining turtle

Sep 7th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. while true do
  2. r=math.random(1,10)
  3. x=0
  4. while x<=r do
  5. if turtle.detect()==false then
  6. turtle.forward()
  7. if peripheral.getType("front")~="computer" then
  8. turtle.dig()
  9. end
  10. sleep(0.2)
  11. else
  12. if turtle.detectDown()==true then
  13. turtle.up()
  14. end
  15. end
  16. x=x+1
  17. end
  18. r=math.random(0,2)
  19. x=0
  20. while x<=r do
  21. turtle.turnRight()
  22. x=x+1
  23. end
  24. if turtle.detectDown()==false then
  25. turtle.down()
  26. end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement