• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Untitled

rollton Dec 4th, 2017 1,825 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. -- запуск: <прога> <правило>
2.
3. -- 6 5 7
4. -- 5 8
5. -- 6 5 6 7
6. -- 5 6 7 8
7. -- 5 2 3
8. -- 5 2 5
9. -- 5 3 5
10. -- 5 3 6
11. -- 5 3 7
12. -- 5 3 8
13. -- 5 4
14. -- 5 4 7
15. -- 5 5 8
16. -- 4 9
17.
18.
19. local component = require("component")
20. local args = require("shell").parse(...)
21.
22. local hologram = component.hologram
23.
25.     mas[x] = mas[x] or {}
26.     mas[x][y] = mas[x][y] or {}
27.     mas[x][y][z] = f
28. end
29.
30. local h = {}
31.
32. local function testLife(xx,yy,zz,jjj)
33.     local life = 0
34.     for x = xx-1, xx+1 do
35.         for y = yy-1, yy+1, (x == xx and y == yy) and 2 or 1 do
36.             for z = zz-1, zz+1, (x == xx and y == yy) and 2 or 1 do
37.                 if h[x] and h[x][y] and h[x][y][z] then life = life + 1 end
38.                 --hologram.set(x,y,z,jjj) os.sleep(0.3) -- < >
39.             end
40.         end
41.     end
42.     return life
43. end
44.
45.
46. -- Set random pole
47.
48. for _ = 1,2500 do
50. end
51.
52. -- Set kub
53.
54. -- for x = 16-1, 16+1 do
55. --  for y = 16-1, 16+1, (x == 16 or y == 16) and 2 or 1 do
56. --      for z = 16-1, 16+1, (x == 16 or y == 16 or z == 16) and 2 or 1 do
58. --      end
59. --  end
60. -- end
61.
62.
63.
64. hologram.clear()
65.
66. for x,yz in pairs(h) do
67.     for y,zz in pairs(yz) do
68.         for z,fl in pairs(zz) do
69.             if fl then hologram.set(x,y,z,3) end
70.         end
71.     end
72. end
73.
74. local rules = {}
75.
76. for i,v in pairs(args) do
77.     rules[i] = args[i] and tonumber(args[i])
78. end
79.
80. rules[1] = rules[1] or 5
81.
82. if not rules[2] then
83.     rules[2] = 6
84.     rules[3] = 7
85.     rules[4] = 8
86. end
87.
88. local function rulesValid(inPut)
89.     local flag
90.     for i = 2,4 do
91.         if not rules[i] then break end
92.         if inPut == rules[i] then flag = true end
93.     end
94.     return flag
95. end
96.
97.
98. while true do
99.
100.     os.sleep(0.4)
101.
102.     local newH, noValid = {}, {}
103.     for xx,vYZ in pairs(h) do
104.         for yy,vZ in pairs(vYZ) do
105.             for zz,out in pairs(vZ) do
106.
107.
108.                 local test = testLife(xx,yy,zz,1)
109.                 if rulesValid(test) then add(newH,xx,yy,zz,true) else hologram.set(xx,yy,zz,0) end
110.
111.                 for x = xx-1, xx+1 do
112.                     for y = yy-1, yy+1, (x == xx and y == yy) and 2 or 1 do
113.                         for z = zz-1, zz+1, (x == xx and y == yy) and 2 or 1 do
114.                             if ( not (noValid[x] and noValid[x][y] and noValid[x][y][z]) ) and ( not (newH[x] and newH[x][y] and newH[x][y][z]) ) and (not(h[x] and h[x][y] and h[x][y][z])) and testLife(x,y,z,3) == rules[1] then
116.                             else
118.                             end
119.                         end
120.                     end
121.                 end
122.
123.
124.             end
125.         end
126.     end
127.     h = newH
128. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.
Top