Advertisement
greenking2000

Mining turtle variable

Jul 1st, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. --http://pastebin.com/Wh6zKyEC --
  2. --Variable tunnel--
  3. --Program name "Var"--
  4.  
  5. print("Variable")
  6. print()
  7.  
  8. --Refuels--
  9. for i=16,1,-1 do
  10.     turtle.select(i)
  11.     turtle.refuel()
  12. end
  13.  
  14. fuel=turtle.getFuelLevel()
  15.  
  16.  
  17. --Asks for dimentions--
  18. print("Width?")
  19. width=read()
  20. print("Height?")
  21. height=read()
  22. print("Distance?")
  23. distance=read()
  24.  
  25. --Calculates movements that will be carried out--
  26. --Number of moves that will be done--
  27. moves=0
  28. --Takes one movement to turn at the end of a width to get ready for the next--
  29. for p=width,0,-1 do
  30.     moves=moves+1
  31. end
  32.  
  33. --Takes "height" movement per "width" to break all the blocks--
  34. for k=height,0,-1 do
  35.     moves=moves+(width*1)
  36. end
  37.  
  38.  
  39.  
  40. if (fuel-(fuel%moves))/moves < 2 then
  41. MaxDistance=0
  42. else
  43. MaxDistance=(fuel-(fuel%(moves)))/(moves)
  44. end
  45. print("Starting tunnel with ",fuel," fuel")
  46. print("That equates to a ",MaxDistance, " long tunnel (Of size 3x3)")
  47.  
  48.  
  49. for y=width,1,-1 do
  50.     for x=height,1,-1 do
  51.         turtle.dig()
  52.         cangoup=turtle.detectUp()
  53.         turtle.up()
  54.     end
  55.     if cangoup==true then
  56.         turtle.down()
  57.     end
  58. turtle.turnRight()
  59. turtle.forward()
  60. furtle.turnLeft()
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement