Skip to content

Commit ed4e96f

Browse files
author
Max Base
authored
Update process.py
1 parent d1ce121 commit ed4e96f

File tree

1 file changed

+46
-15
lines changed

1 file changed

+46
-15
lines changed

process.py

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,42 @@
22
# https://github.com/BaseMax/PhdMathProject
33
import string
44
import sys
5+
# x = int(e1.get())
6+
# assert x >= 0
7+
# if x == 0:
8+
# return [[0]]
9+
# binary = []
10+
# while x != 0:
11+
# temp = [0, 0, 0]
12+
# for k in range(3):
13+
# temp[k] = ((x % 10) // (2 ** (2 - k))) % 2
14+
# binary.append(temp.copy())
15+
# x = x // 10
16+
# binary.reverse()
17+
# data = (binary)
518
data=[
619
[0,1,1],
720
[1,0,0],
821
[1,0,1],
922
]
23+
# 145
24+
data=[
25+
[0,0,1],
26+
[1,0,0],
27+
[1,0,1],
28+
]
29+
# 137
30+
data=[
31+
[0,0,1],##1
32+
[0,1,1],##3
33+
[1,1,1],##7
34+
]
35+
# 123
36+
data=[
37+
[0,0,1],##1
38+
[0,1,0],##2
39+
[0,1,1],##3
40+
]
1041
newData=[]
1142
bits=3
1243
count=len(data)
@@ -74,20 +105,19 @@
74105
dashed_edges=[]
75106

76107
for x in range(len(clearformulas)):
77-
clearformulas[x].append(1)
78-
for y in range(bits):
79-
if clearformulas[x][y-1] == 0 or clearformulas[x][y-1] == 1:
108+
if len(clearformulas[x]) == 1:
109+
clearformulas[x].append(clearformulas[x][0])
110+
clearformulas[x]= ( clearformulas[x][0] , clearformulas[x][1])
111+
isDash=False
112+
selectedValue=clearformulas[x]
113+
for clearItem in clearformulas[x]:
114+
if clearItem.endswith("'"):
115+
isDash=True
80116
break
81-
try:
82-
if clearformulas[x][y-1][ len(str(clearformulas[x][y-1])) -1] == "'":
83-
clearformulas[x][ len(str(clearformulas[x])) -1]=0
84-
break
85-
except IndexError:
86-
continue
87-
if clearformulas[x][ len(clearformulas[x]) -1] == 0:
88-
dashed_edges.append(clearformulas[x][:-1])
117+
if isDash:
118+
dashed_edges.append(selectedValue)
89119
else:
90-
line_edges.append(clearformulas[x][:-1])
120+
line_edges.append(selectedValue)
91121

92122
print("Add bordertype to clearformulas: ", clearformulas)
93123

@@ -100,14 +130,15 @@
100130
print("dashed edges: ", dashed_edges)
101131

102132
def toChild(value):
103-
return alphas.index(value)
133+
return value
134+
return alphas.index(value[0])
104135
# return int(ord(value))
105136

106137
grapsLine=[]
107138
for i in range(len(line_edges)):
108139
if len(line_edges[i]) == 1:
109140
if len(line_edges) != 1:
110-
grapsLine.append((toChild(line_edges[i][0][0]), toChild(line_edges[i+1][0][0])))
141+
grapsLine.append((toChild(line_edges[i][0]), toChild(line_edges[i+1][0])))
111142
else:
112143
print("Error: cannot find a edges to connect to this single edge to create a vertex!")
113144
if len(line_edges[i]) == 2:
@@ -131,7 +162,7 @@ def toChild(value):
131162
# dashed_edges=[(1,2), (1,2)]
132163
# dashed_edges=[(1,2), (1,3), (1,4)]
133164

134-
print("dashed_edges: ", dashed_edges)
165+
print("grapsDashed: ", dashed_edges)
135166

136167
# use grapsLine
137168
# use grapsDashed

0 commit comments

Comments
 (0)