-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenf.py
99 lines (74 loc) · 1.72 KB
/
genf.py
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
96
97
98
99
import itertools
import pyexcel as pe
outs=open('faulty_output.txt', 'w')
a = 2 ** 3
total=list()
def truth_push(input_result):
newstring = str(input_result[0])
for ch in range(1,len(input_result)):
newstring+=str(input_result[ch])
levels.append(newstring)
def truth_fix(input_result):
for n, i in enumerate(input_result):
if i == True:
result[n] = 1
if i == False:
result[n] = 0
def getheader(cc):
che=['Level-0']
for ch in range(cc):
che.append('Level - '+str(ch+1))
if ch == cc-1:
che.append('Level-'+str(ch+2))
return che
def getheaders(cc,lines):
che=[lines]
for ch in range(cc):
che.append(lines)
if ch == cc-1:
che.append(lines)
return che
lines =str('a,b,c')
lines=lines.replace(',','')
testPatterns = table = list(itertools.product([0, 1], repeat=3))
for p in testPatterns:
levels = list()
a,b,c = p
result = [a,b,c]
truth_push(result)
a=a and b
b=a
#Bridging
c = a ^ c
result = [a,b,c]
truth_fix(result)
truth_push(result)
b = c ^ b
result = [a,b,c]
truth_fix(result)
truth_push(result)
a = (b and c) ^ a
result = [a,b,c]
truth_fix(result)
truth_push(result)
c = (a and b) ^ c
result = [a,b,c]
truth_fix(result)
truth_push(result)
c = b ^ c
result = [a,b,c]
truth_fix(result)
truth_push(result)
a=a and b
b=a
#Bridging
total.append(levels)
count = 4
che=list()
che=getheader(count)
ches=getheaders(count,lines)
total.insert(0,che)
total.insert(1,ches)
sheet=pe.Sheet(total)
outs.write(str(sheet.content))
sheet.save_as('/home/joy/Desktop/test/testsf.csv')