forked from Lakshyasukhralia/CellularAutomata
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTempRule.py
More file actions
95 lines (91 loc) · 2.75 KB
/
TempRule.py
File metadata and controls
95 lines (91 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
from Rules import *
import numba as nb
#Rec = False
#Input by user
'''for i in range(0,8):
j = int(input(""))
IV.append(j)
'''
#@nb.jit(nopython=True)
def HashFunC(L,time,RV):
j = 0
IV1 = L[:]
IV2 = []
x = 0
RV = False
Rec = False
IV = L[:]
#print(IV)
#print(IV)
#print("Generation 0")
#print(IV)
#Cycles should be a minimum of 8 else Error
for j in range(1,time):
if Rec == True:
#print("End")
return j-1,IV
break
x = 0
IV2.clear()
for i in IV:
if x == 0:
a = 0
b = i
c = IV[x+1]
#print(a,b,c,"-->",R30(a,b,c))
#print("R90")
IV2.append(R90(a,b,c))
x = x+1
else:
if x == 7:
a = IV[x-1]
b = i
c = 0
#print(a,b,c,"-->",R30(a,b,c))
if RV == False:
#print("R90")
IV2.append(R90(a,b,c))
else:
#print("R30")
IV2.append(R30(a,b,c))
#print("Generation",j)
#print(IV2)
if IV2 == IV1:
print("Initial Stage Achieved! \n")
#print(IV2)
Rec = True
IV = IV2[:]
break
IV = IV2[:]
break
else:
a = IV[x-1]
b = i
c = IV[x+1]
#print(a,b,c,"-->",R30(a,b,c))
if RV == False:
#print("R90")
IV2.append(R90(a,b,c))
else:
if x == 1:
#print("R30")
IV2.append(R30(a,b,c))
elif x == 2:
#print("R90")
IV2.append(R90(a,b,c))
elif x == 3:
#print("R30")
IV2.append(R30(a,b,c))
elif x == 4:
#print("R90")
IV2.append(R90(a,b,c))
elif x == 5:
#print("R30")
IV2.append(R30(a,b,c))
elif x == 6:
#print("R90")
IV2.append(R90(a,b,c))
x = x+1
return j,IV
#print(HashFunC([0,0,0,0,0,1,1,0],1000000))
#print(HashFunC([1,1,1,1,1,1,1,1],10000000))