Advertisement
Infero93

Mover

Nov 25th, 2015
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. --[[ Variables ]]--
  2. local max     = 58
  3. local half    = 58/2
  4. local block   = half - 2
  5. local counter = 0
  6. local both    = 0
  7.  
  8. --[[ Preconf ]]--
  9. turtle.select(1)
  10.  
  11. print("MAX:     " .. max)
  12. print("HALF:    " .. half)
  13. print("BLOCK:   " .. block)
  14. print("COUNTER: " .. counter)
  15. print("BOTH:    " .. both)
  16.  
  17. --[[ Main loop ]]--
  18. while true do
  19.  
  20.     counter = counter + 1
  21.     turtle.forward()
  22.     print("COUNTER: " .. counter)
  23.     print("BLOCK:   " .. block)
  24.     print("BOTH:    " .. both)
  25.    
  26.     if(counter == block and both < 2) then
  27.         turtle.up()
  28.         turtle.placeDown()
  29.         turtle.forward()
  30.         counter = counter + 1
  31.         turtle.down()
  32.         both  = both + 1
  33.         block = block + 4
  34.     end
  35.        
  36.     if turtle.detect() then
  37.         break
  38.     end
  39. end
  40.  
  41. turtle.turnLeft()
  42. turtle.turnLeft()
  43.  
  44. --[[ Preconf ]]--
  45. counter = 0
  46. local f_block = 0
  47. local s_block = 0
  48.  
  49. --[[ Second main loop ]]--
  50. while true do
  51.  
  52.     counter = counter + 1
  53.     turtle.forward()
  54.    
  55.     if turtle.detect() then
  56.    
  57.         if(f_block > 0 and s_block > 0) then
  58.             break
  59.         end
  60.    
  61.         turtle.up()
  62.         turtle.forward()
  63.         counter = counter + 1
  64.        
  65.         if(f_block > 0) then
  66.             s_block = counter
  67.         end
  68.        
  69.         if(f_block == 0) then
  70.             f_block = counter
  71.         end
  72.        
  73.         turtle.forward()
  74.         counter = counter + 1
  75.         turtle.down()
  76.  
  77.     end
  78. end
  79.  
  80. print("COUNTER: " .. counter)
  81. print("F_BLOCK: " .. f_block)
  82. print("S_BLOCK: " .. s_block)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement