SHARE
TWEET

Untitled

lazypanda07 May 19th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. distance=0
  2. items=0
  3.  
  4. function lay( height,width )
  5.    
  6.     width=width-1
  7.  
  8.     turtle.dig()
  9.     items=items+1
  10.     turtle.forward()
  11.  
  12.     for i=1,height do
  13.        
  14.         turtle.turnLeft()
  15.         for j=1,width/2 do
  16.             turtle.dig()
  17.             items=items+1
  18.             turtle.forward()
  19.         end
  20.  
  21.         for j=1,width/2 do
  22.             turtle.back()
  23.             os.sleep(1)
  24.         end
  25.  
  26.         turtle.turnRight()
  27.         turtle.turnRight()
  28.  
  29.         for j=1,width/2 do
  30.             turtle.dig()
  31.             items=items+1
  32.             turtle.forward()
  33.         end
  34.  
  35.         for j=1,width/2 do
  36.             turtle.back()
  37.             os.sleep(1)
  38.         end
  39.        
  40.         turtle.turnLeft()
  41.  
  42.         if i~=height then
  43.             io.write(height)
  44.             io.write("\n")
  45.             turtle.digUp()
  46.             turtle.up()
  47.         end
  48.        
  49.        
  50.  
  51.         distance=distance+1
  52.     end
  53.  
  54.     for i=1,height-1 do
  55.         turtle.down()
  56.         os.sleep(1)
  57.     end
  58.  
  59.     if turtle.getItemCount(16)>0 then
  60.         for i=1,distance do
  61.             turtle.back()
  62.             os.sleep(1)
  63.         end
  64.         turtle.turnLeft()
  65.         turtle.turnLeft()
  66.  
  67.         for i=1,16 do
  68.             turtle.select(i)
  69.             turtle.drop()
  70.         end
  71.        
  72.         turtle.select(1)
  73.  
  74.         turtle.turnLeft()
  75.         turtle.turnLeft()
  76.  
  77.     end
  78.  
  79. end
  80.  
  81. io.write(string.format( "Input height\n" ))
  82. height=read()
  83. io.write(string.format("Input width (odd number)\n"))
  84. width=read()
  85.  
  86. lay(height,width)
  87.  
  88. for i=1,distance do
  89.     turtle.forward()
  90.     os.sleep(1)
  91. end
  92.  
  93. lay(height,width)
  94.  
  95. io.write("Total items:")
  96. io.write(items)
  97. io.write("\n")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top