yzrhnd

Untitled

Nov 1st, 2016
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. -- 逆ピラミッド
  2.  
  3. local num = 10
  4.  
  5. local lnum=0
  6.  
  7. turtle.select(1)
  8.  
  9. for i = 1,10 do
  10. turtle.up()
  11. end
  12.  
  13. -- ここから
  14.  
  15. for k=1,num do
  16.  
  17. turtle.up()
  18. for j =-1*num ,num do
  19. for i = -1*num,num do
  20.  
  21. placeFlag = 0
  22.  
  23. if i >=0 and j >= 0 then
  24. if (num)^2 <= (j+0.5)^2 + (i+0.5)^2 then
  25. if (num)^2 >= (j-0.5)^2 + (i-0.5)^2 then
  26. placeFlag = 1
  27. end
  28. end
  29. elseif i < 0 and j >= 0 then
  30. if (num)^2 <= (j+0.5)^2 + (i-0.5)^2 then
  31. if (num)^2 >= (j-0.5)^2 + (i+0.5)^2 then
  32. placeFlag = 1
  33. end
  34. end
  35. elseif i >= 0 and j < 0 then
  36. if (num)^2 <= (j-0.5)^2 + (i+0.5)^2 then
  37. if (num)^2 >= (j+0.5)^2 + (i-0.5)^2 then
  38. placeFlag = 1
  39. end
  40. end
  41. else
  42. if (num)^2 <= (j-0.5)^2 + (i-0.5)^2 then
  43. if (num)^2 >= (j+0.5)^2 + (i+0.5)^2 then
  44. placeFlag = 1
  45. end
  46. end
  47.  
  48. end
  49.  
  50. if placeFlag == 1 then
  51. if turtle.getItemCount() == 0 then
  52. selectNum = turtle.getSelectedSlot()
  53. if selectNum == 16 then
  54. selectNum = 0
  55. end
  56. turtle.select(selectNum+1)
  57. end
  58. turtle.placeDown()
  59. end
  60.  
  61.  
  62. turtle.forward()
  63. end
  64.  
  65. for i = -1*num,num do
  66. turtle.back()
  67. end
  68.  
  69. turtle.turnRight()
  70. turtle.forward()
  71. turtle.turnLeft()
  72.  
  73. end
  74.  
  75. turtle.turnLeft()
  76. for j =-1*num ,num do
  77. turtle.forward()
  78. end
  79. turtle.back()
  80. turtle.turnRight()
  81. turtle.forward()
  82.  
  83. num = num -1
  84. end
Advertisement
Add Comment
Please, Sign In to add comment