Advertisement
HolOoD

NewBridge

Aug 22nd, 2023
787
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.79 KB | Gaming | 0 0
  1. --Построение моста
  2.  
  3. print("Впиши длину пути")
  4. local x = io.read()
  5.  
  6. print("Впиши ширину пути")
  7. local y = io.read()
  8.  
  9. function vpered(a)
  10.    -- turtle.up()
  11.    
  12.     for i=1,a do
  13.         turtle.forward()
  14.         turtle.placeDown()
  15.              
  16.         vibor()
  17.     end
  18.  
  19. end
  20.  
  21. function vibor()
  22.  
  23.     for b=1,16 do
  24.         if turtle.getItemCount(b) == 0 then
  25.            turtle.select(b+1)
  26.         else
  27.                
  28.            return
  29.            
  30.         end
  31.     end
  32.    
  33. end
  34.  
  35. function nazad(c)
  36.  
  37.     turtle.turnLeft()
  38.     turtle.turnLeft()
  39.    
  40.     for i=1,c do
  41.         turtle.forward()
  42.     end
  43. end
  44.  
  45. for i = 1,y do
  46.     vibor()
  47.     vpered(x)
  48.     nazad(x)
  49.     turtle.turnLeft()
  50.     turtle.forward()
  51.     turtle.turnLeft()
  52. end
Tags: turtle
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement