yzrhnd

Untitled

Oct 31st, 2016
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 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 j =-1*num ,num do
  16. for i = -1*num,num do
  17.  
  18. if i >=0 and j >= 0 then
  19. if (num)^2 <= (j+0.5)^2 + (i+0.5)^2 then
  20. if (num)^2 >= (j-0.5)^2 + (i-0.5)^2 then
  21. turtle.placeDown()
  22. end
  23. end
  24. elseif i < 0 and j >= 0 then
  25. if (num)^2 <= (j+0.5)^2 + (i-0.5)^2 then
  26. if (num)^2 >= (j-0.5)^2 + (i+0.5)^2 then
  27. turtle.placeDown()
  28. end
  29. end
  30. elseif i >= 0 and j < 0 then
  31. if (num)^2 <= (j-0.5)^2 + (i+0.5)^2 then
  32. if (num)^2 >= (j+0.5)^2 + (i-0.5)^2 then
  33. turtle.placeDown()
  34. end
  35. end
  36. else
  37. if (num)^2 <= (j-0.5)^2 + (i-0.5)^2 then
  38. if (num)^2 >= (j+0.5)^2 + (i+0.5)^2 then
  39. turtle.placeDown()
  40. end
  41. end
  42.  
  43. end
  44.  
  45.  
  46. turtle.forward()
  47. end
  48.  
  49. for i = -1*num,num do
  50. turtle.back()
  51. end
  52.  
  53. turtle.turnRight()
  54. turtle.forward()
  55. turtle.turnLeft()
  56.  
  57. end
Advertisement
Add Comment
Please, Sign In to add comment