• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

a guest Jun 19th, 2019 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
2. x = 0
3. y = 0
4.
5. function round(x)
6.  n = x % 1
7.
8.  if n >= 0.5 then
9.   return math.ceil(x)
10.  else
11.   return math.floor(x)
12.  end
13. end
14.
15. function getQuaterSector(r,y)
16.  sectorEdges = {}
17.
18.   while x <= r^2 do
19.
20.    z = math.sqrt(r^2-x-y^2)
21.
22.    if math.sqrt(x) % 1 == 0 then
23.     table.insert(sectorEdges,{math.sqrt(x),round(z)})
24.    end
25.
26.    x = x + 1
27.
28.   end
29.
30.  return sectorEdges
31. end
32.
33. function moveToOnYPlane(x1,z1,x2,z2)
34.
35.  XDiff=x2-x1
36.  if XDiff>0 then
37.   turtle.turnRight()
38.  elseif XDiff<0 then
39.   turtle.turnLeft()
40.  end
41.
42.  tempDiff = 0
43.  if XDiff<0 then tempDiff = -XDiff else tempDiff=XDiff end
44.   i=0
45.
46.   while i<tempDiff do
47.    turtle.forward()
48.    i=i+1
49.   end
50.
51.  if XDiff>0 then
52.   turtle.turnLeft()
53.  elseif XDiff<0 then
54.   turtle.turnRight()
55.  end
56.
57.  ZDiff =z2-z1
58.  if ZDiff<0 then
59.   turtle.turnLeft()
60.   turtle.turnLeft()
61.  end
62.
63.  tempDiff2=0
64.  if ZDiff <0 then tempDiff2 = -ZDiff else tempDiff2 = ZDiff end
65.
66.  b=0
67.  while b<tempDiff2 do
68.   turtle.forward()
69.   b = b+1
70.  end
71.
72.  if ZDiff<0 then
73.   turtle.turnLeft()
74.   turtle.turnLeft()
75.  end
76.
77. end
78.
79. function placeSector(arr)
80.     a=0
81.     while a < table.getn(arr) do
82.     moveToOnYPlane(0,0,arr[a][1],arr[a][2])
83.     turtle.placeDown()
84.     moveToOnYPlane(arr[a][1],arr[a][2],0,0)
85.     a = a + 1
86.     end
87. end
88.
91.     placeSector(arr)
92.     turtle.turnRight()
93.     placeSector(arr)
94.     turtle.turnRight()
95.     placeSector(arr)
96.     turtle.turnRight()
97.     placeSector(arr)
98.     turtle.turnRight()
99. end
100.
103.     while a>0 do
105.         turtle.up()
106.         a = a-1
107.     end
108.     turtle.placeUp()
109.     while a != radius do
110.         turtle.down()
111.         a=a+1
112.     end
113.     while a<0 do
115.         turtle.down()
116.         a = a-1
117.     end