yzrhnd

Untitled

Oct 31st, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. -- 逆ピラミッド
  2.  
  3. local num = 16
  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 j =-1*num ,num do
  16. for i = -1*num,num do
  17.  
  18. placeFlag = 0
  19.  
  20. if i >=0 and j >= 0 then
  21. if (num)^2 <= (j+0.5)^2 + (i+0.5)^2 then
  22. if (num)^2 >= (j-0.5)^2 + (i-0.5)^2 then
  23. placeFlag = 1
  24. end
  25. end
  26. elseif i < 0 and j >= 0 then
  27. if (num)^2 <= (j+0.5)^2 + (i-0.5)^2 then
  28. if (num)^2 >= (j-0.5)^2 + (i+0.5)^2 then
  29. placeFlag = 1
  30. end
  31. end
  32. elseif i >= 0 and j < 0 then
  33. if (num)^2 <= (j-0.5)^2 + (i+0.5)^2 then
  34. if (num)^2 >= (j+0.5)^2 + (i-0.5)^2 then
  35. placeFlag = 1
  36. end
  37. end
  38. else
  39. if (num)^2 <= (j-0.5)^2 + (i-0.5)^2 then
  40. if (num)^2 >= (j+0.5)^2 + (i+0.5)^2 then
  41. placeFlag = 1
  42. end
  43. end
  44.  
  45. end
  46.  
  47. if placeFlag == 1 then
  48. if turtle.getItemCount() == 0 then
  49. selectNum = turtle.getSelectedSlot()
  50. if selectNum == 16 then
  51. selectNum = 0
  52. end
  53. turtle.select(selectNum+1)
  54. end
  55. turtle.placeDown()
  56. end
  57.  
  58.  
  59. turtle.forward()
  60. end
  61.  
  62. for i = -1*num,num do
  63. turtle.back()
  64. end
  65.  
  66. turtle.turnRight()
  67. turtle.forward()
  68. turtle.turnLeft()
  69.  
  70. end
Advertisement
Add Comment
Please, Sign In to add comment