Advertisement
R0cks1

Flat (Up to date)

May 3rd, 2024
736
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.08 KB | None | 0 0
  1. --This program mine a X by X square
  2.  
  3. function minage(x)
  4.     for i = 1,2*x,1 do
  5.         turtle.dig()
  6.         turtle.forward()
  7.     end
  8.     turtle.turnRight()
  9.     turtle.dig()
  10.     turtle.forward()
  11.     turtle.turnRight()
  12. end
  13.  
  14. function minage2(x)
  15.     for i = 1,2*x,1 do
  16.         turtle.dig()
  17.         turtle.forward()
  18.     end
  19.     turtle.turnLeft()
  20.     turtle.dig()
  21.     turtle.forward()
  22.     turtle.turnLeft()
  23. end
  24.  
  25. function LR(x)
  26.     for i = 1,x,1 do
  27.         minage2(x)
  28.         minage(x)
  29.         if turtle.getFuelLevel() <= 2*x then turtle.refuel() end
  30.     end
  31. end
  32.  
  33. function RL(x)
  34.     for i = 1,x,1 do
  35.         minage(x)
  36.         minage2(x)
  37.         if turtle.getFuelLevel() <= 2*x then turtle.refuel() end
  38.     end
  39. end
  40.  
  41. function depart()
  42.     print("Don't forget to put fuel in 1st slot for the turtle before running this program")
  43.     io.read()
  44.     print("\nWich way would you like to  dig first ? R / L")
  45.     s = io.read()
  46.     print("\nNumber of lines to dig")
  47.     x = io.read("Range a creuser")
  48.     math.floor(x/2)
  49.    
  50.     if s == "R" then
  51.         RL(x)
  52.     end
  53.    
  54.     if s == "L" then
  55.         LR(x)
  56.     else
  57.         depart()
  58.     end
  59. end
  60.  
  61. depart()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement