-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_verbal_options.py
112 lines (107 loc) · 3.66 KB
/
generate_verbal_options.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
100
101
102
103
104
105
106
107
108
109
110
111
criteriaX = {"The darker among left/right dependent if sample is X" :
"""if(middleShape.label == "X")
{
if(darker(leftShape, rightShape))
{
return chosenShape.location == "left";
}
else
if(darker(rightShape, leftShape))
{
return chosenShape.location == "right";
}
}""",
"The brighter among left/right dependent if sample is X":
"""if(middleShape.label == "X")
{
if(brighter(leftShape, rightShape))
{
return chosenShape.location == "left";
}
else
if(brighter(rightShape, leftShape))
{
return chosenShape.location == "right";
}
}
""",
"The left one if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.location == "left";
}
""",
"The right one if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.location == "right";
}
""",
"The one with brightness 0.99 if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.shade == "B_0.99";
}
""",
"The one with brightness 0.00 if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.shade == "B_0.00";
}""",
"The one with brightness 0.50 if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.shade == "B_0.50";
}
""",
"The one with circle shape if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.shape == "circle";
}
""",
"The one with rectangle shape if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.shape == "rectangle";
}
""",
"The one with triangle shape if sample is X":
"""if(middleShape.label == "X")
{
return chosenShape.shape == "triangle";
}
"""}
criterias = []
for x in criteriaX:
for y in criteriaX:
criterias += [(x,y)]
#print((x,y))
codes = []
options = []
switchStatements = []
criteriaslist = ["criterias = ["]
for i,(x,y) in enumerate(criterias):
criteriaslist.append(f"criteria_N{i},")
switchStatements.append("""case "N"""+str(i)+"""": selectedCriteria = criteria_N"""+str(i)+"""; break;""")
options.append("""<option value="N"""+str(i)+"""">""" + x + ", " + y.replace("X","Y") + """</option>""")
code = """function criteria_N_INDEXI_(chosenShape, leftShape, middleShape, rightShape)
{"""
code += criteriaX[x]
code += criteriaX[y].replace("X","Y")
code += """return false;
}"""
code = code.replace("_INDEXI_",str(i))
codes.append(code)
criteriaslist.append("]")
for x in codes:
print(x)
print("\n\n\n\n\n")
for x in options:
print(x)
print("\n\n\n\n\n")
for x in switchStatements:
print(x)
print("\n\n\n\n\n")
for x in criteriaslist:
print(x)