mazenh

Space

May 15th, 2021
523
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --inputs----------------------------
  2. write("Length:")
  3. L=read()
  4. write("Width:")
  5. W=read()
  6. W=W/2
  7. write("Hight(/3):")
  8. H=read()
  9. print(" ")
  10. --functions-------------------------
  11.  
  12. function digup()
  13.   turtle.digUp()
  14.   turtle.digUp()
  15.   turtle.digUp()
  16.   turtle.digUp()
  17.   turtle.digUp()
  18. end
  19.  
  20. function digf()
  21.   turtle.dig()
  22.   turtle.dig()
  23.   turtle.dig()
  24.   turtle.dig()
  25.   turtle.dig()
  26. end
  27.  
  28. function dig(x)
  29.   digup()
  30.   turtle.digDown()
  31.   for i=1,x do
  32.     digf()
  33.     turtle.forward()
  34.     turtle.digDown()
  35.     digup()
  36.   end
  37. end
  38.  
  39.  
  40. --main loop-------------------------
  41. for i=1,H do
  42.   for j=1,W do
  43.     write(i)
  44.      write("  W/2=")
  45.       write(W)
  46.        write("  J=")
  47.         print(j)
  48.     dig(L-1)
  49.     turtle.turnRight()
  50.     digf()
  51.     turtle.forward()
  52.     turtle.turnRight()
  53.     dig(L-1)
  54.     if j~=W then
  55.       turtle.turnLeft()
  56.       digf()
  57.       turtle.forward()
  58.       turtle.turnLeft()
  59.     end
  60.   end
  61.  
  62.   turtle.turnRight()
  63.   for u=1,W*2-1 do
  64.     turtle.forward()
  65.   end
  66.   turtle.turnRight()
  67.   if i==H then break end
  68.  
  69.   if i~=H then
  70.     write("going up! i=") write(i)
  71.     write("  H= ") print(H)
  72.     for u2=1,3 do
  73.       turtle.up()
  74.       digup()
  75.     end
  76.   end
  77.  
  78. end
  79.  
  80. for u3=1,3*H do
  81.   turtle.down()
  82. end
  83.  
  84.  
RAW Paste Data