1. -- Variables
  2. turtle.select(1)
  3. local tArgs = { ... }
  4. local togo = tonumber(tArgs[1])
  5. togo = togo or 1
  6. print("Going Boss!")
  7.  
  8. -- Functions
  9. function tfuel(amount)
  10.  if turtle.getFuelLevel() < 5 then
  11.   turtle.select(16)
  12.   turtle.refuel(amount)
  13.   turtle.select(1)
  14.  end
  15. end
  16.  
  17. function turnaround()
  18.   turtle.turnRight()
  19.   turtle.turnRight()
  20. end
  21.  
  22. function uandd()
  23.   if turtle.detectUp() then
  24.    turtle.digUp()
  25.   end
  26.   if turtle.detectDown() then
  27.    turtle.digDown()
  28.   end
  29. end
  30.  
  31. -- Starting Out
  32. for i = 1, togo do
  33.   tfuel(1)
  34.   if turtle.detect() then
  35.    repeat
  36.     turtle.dig()
  37.     sleep(0.25)
  38.    until turtle.detect() == false
  39.    turtle.forward()
  40.    uandd()
  41.   else
  42.    turtle.forward()
  43.    uandd()
  44.   end
  45.   if togo >= 10 then
  46.    if (i % 10 == 0) then
  47.     turtle.placeDown()
  48.    end
  49.   end
  50. end
  51.  
  52. --Lets assume that worked and he made it
  53. turnaround()
  54. for r = 1, togo do
  55.  tfuel(1)
  56.  turtle.forward()
  57. end