asweigart

Untitled

Jul 29th, 2016
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. -- Chop Tree program
  2. -- By Al Sweigart
  3. -- Run with tree in front of turtle
  4. -- to chop it down.
  5.  
  6. if not turtle.detect() then
  7. return -- nothing there, so exit
  8. end
  9.  
  10. print('Chopping tree...')
  11.  
  12. turtle.dig() -- chop base
  13. turtle.forward() -- move under tree
  14. while turtle.compareUp() do
  15. -- keep chopping until no more wood
  16. turtle.digUp()
  17. turtle.up()
  18. end
  19.  
  20. -- move back to ground
  21. while not turtle.detectDown() do
  22. turtle.down()
  23. end
  24.  
  25. print('Done chopping tree.')
Advertisement
Add Comment
Please, Sign In to add comment