-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDP_FreeCAD.py
89 lines (81 loc) · 3.36 KB
/
DP_FreeCAD.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
__author__ = 'Ear'
import SearchAgent
import SearchAgent_Post
shape = ['o', 'cy1', 'cy2', 'cy3', 'cube', 'sphere', 'union1', 'union2', 'intersect', 'subtract']
boolOp = [0, 0, 0, 0, 0, 0, 0, 0]
def checkwin():
unioncount = boolOp[0:4].count(1) + boolOp[0:4].count(2) + boolOp[0:4].count(3) + boolOp[0:4].count(6) + boolOp[
0:4].count(
7)
shapecount = boolOp[0:4].count(1) + boolOp[0:4].count(2) + boolOp[0:4].count(3)
testlen = len(boolOp[6:8])
if boolOp.count(0) == 0:
if unioncount < 4:
return -10
else:
if boolOp[4:6].count(9) + boolOp[4:6].count(4) + boolOp[4:6].count(5) < 2:
return -10
else:
if 6 in boolOp[6:8] == False and 7 in boolOp[6:8] == False:
return -10
else:
if boolOp[6:8].count(4) + boolOp[6:8].count(5) + boolOp[6:8].count(8) < 1:
return -10
else:
if boolOp[6:8].count(6) != 0:
if boolOp[6:8].count(4) != 0 and boolOp[6:8].index(6) < boolOp[6:8].index(4):
return -10
if boolOp[6:8].count(5) != 0 and boolOp[6:8].index(6) < boolOp[6:8].index(5):
return -10
if boolOp[6:8].count(8) != 0 and boolOp[6:8].index(6) < boolOp[6:8].index(8):
return -10
else:
return 10
if boolOp[6:8].count(7) != 0:
if boolOp[6:8].count(4) != 0 and boolOp[6:8].index(7) < boolOp[6:8].index(4):
return -10
if boolOp[6:8].count(5) != 0 and boolOp[6:8].index(7) < boolOp[6:8].index(5):
return -10
if boolOp[6:8].count(8) != 0 and boolOp[6:8].index(7) < boolOp[6:8].index(8):
return -10
else:
return 10
return 0
def renew():
shape[0] = 'o'
shape[1] = 'cy1'
shape[2] = 'cy2'
shape[3] = 'cy3'
shape[4] = 'cube'
shape[5] = 'sphere'
shape[6] = 'union1'
shape[7] = 'union2'
shape[8] = 'intersect'
shape[9] = 'subtract'
for i in range(0, len(boolOp)):
boolOp[i] = 0
return
def screen(run):
print "Runtime:", run
print shape[1], shape[2], shape[3], shape[4], shape[5], shape[6], shape[7], shape[8], shape[9]
print boolOp[0], boolOp[1], boolOp[2], boolOp[3], boolOp[4], boolOp[5], boolOp[6], boolOp[7]
return
def main():
choice=input("Select task, 1 for training model, 2 for post-test")
if choice==1:
trail=1
runtime=1
for i in range(0,trail):
FreeCADAgent=SearchAgent.Tree()
FreeCADAgent.Initilize(runtime,i)
renew()
FreeCADAgent.AgentInit(i)
if choice==2:
trail=1
runtime=1
FreeCADAgent=SearchAgent_Post.Tree()
FreeCADAgent.Initilize(runtime,trail)
renew()
FreeCADAgent.AgentInit(trail)
return
main()