Advertisement
Guest User

mined

a guest
Oct 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. t = turtle
  2. function miF()
  3.   if t.detect() then
  4.     t.dig()
  5.   end
  6. end
  7. function moF()
  8.   if not t.detect() then
  9.     t.forward()
  10.   end
  11. end
  12. function mmF()
  13.   miF()
  14.   moF()
  15. end
  16. function miU()
  17.   if t.detectUp() then
  18.     t.digUp()
  19.   end
  20. end
  21. function mm()
  22.   mmF()
  23.   miU()
  24. end
  25. function fu(num)
  26.   t.refuel(num/40)
  27. end
  28. function go(num)
  29.   while num > 0 do
  30.     mm()
  31.     num = num - 1
  32.     if not t.detectDown() then
  33.       t.placeDown()
  34.     end
  35.   end
  36. end
  37. function dis()
  38.   num = io.read()
  39.   num = tonumber(num)
  40.   return num
  41. end
  42. function a()
  43.   print("Input distance: ")
  44.   num = dis()
  45.   fu(num)
  46.   go(num)
  47.   t.turnLeft()
  48.   t.turnLeft()
  49.   go(num)
  50. end
  51.  
  52. a()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement