Advertisement
yzrhnd

Untitled

Oct 26th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. -- 逆ピラミッド
  2.  
  3. local num = 10
  4.  
  5. local lnum=0
  6.  
  7.  
  8. for k=1,4 do
  9. for j=0,2*num do
  10. local nn = 0
  11. lnum =10000000
  12. for i = 1,num do
  13. y = ((num - j)^2) + (i^2) - (num ^ 2)
  14. y= math.abs(y)
  15. if y <= lnum then
  16. lnum = y
  17. nn = i
  18. end
  19.  
  20. end
  21.  
  22. for i = 1,num do
  23. turtle.up()
  24. if i == nn then
  25. turtle.placeDown()
  26. end
  27. end
  28. turtle.forward()
  29. for i = 1,num do
  30. turtle.down()
  31. end
  32.  
  33. end
  34.  
  35. turtle.turnRight()
  36. turtle.forward()
  37. turtle.turnLeft()
  38.  
  39. for i = 0,2*num do
  40. turtle.back()
  41. end
  42.  
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement