Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. local alto = 6
  2. local ancho = 8
  3.  
  4. function recargar()
  5.     turtle.select(1)
  6.     if turtle.getItemCount() == 0 then
  7.         print("sin combustible")
  8.         turtle.down()
  9.         exit()
  10.     else
  11.         turtle.refuel(1)
  12.         turtle.select(2)
  13.     end
  14. end
  15.  
  16. function plantarAlto()
  17.     local count = 0
  18.     while count < alto do
  19.         count = count + 1
  20.         turtle.placeDown()
  21.         if not count == alto
  22.             turtle.forward()
  23.         end
  24.     end  
  25. end
  26.  
  27. print("empezamos")
  28. if turtle.getFuelLevel() < 50 then
  29.     recargar()
  30.     local ccount = 0
  31.    
  32.     while ccount < ancho do
  33.         plantarAlto()
  34.        
  35.         if (ccount % 2 == 0) then
  36.             turtle.turnLeft()
  37.             turtle.forward()
  38.             turtle.turnLeft()
  39.         else
  40.             turtle.turnRight()
  41.             turtle.forward()
  42.             turtle.turnRight()
  43.         end
  44.        
  45.         ccount = ccount + 1
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement