-
Notifications
You must be signed in to change notification settings - Fork 0
/
evaluation_constant.py
213 lines (201 loc) · 14.7 KB
/
evaluation_constant.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# evaluation_constant.py
# 평가함수에서 사용되는 패턴과 그에 대응하는 점수 및
# 끝내기 패턴, 필수 방어 패턴을 정의 해놓은 파일
from gomoku_constant import *
PLAYER1_7PATTERNS = [[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, AI], # 5. 양쪽에 상대편 바둑돌들이 막고있는 빈칸 하나 있는사목
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY], # 3. 빈칸 하나 있는 사목
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI], # 4. 상대편 바둑돌이 막고 있고 빈칸 하나 있는 사목
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY]]
PLAYER1_6PATTERNS = [[EMPTY, PLAYER1, PLAYER1, PLAYER1, PLAYER1, EMPTY], # 2. 사목
[EMPTY, PLAYER1, PLAYER1, PLAYER1, PLAYER1, AI], # 7. 상대편 바둑돌이 막고 있는 사목
[AI, PLAYER1, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY], # 8. 빈칸 있는 삼목
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI], # 9. 빈칸 있고 상대편 바둑돌이 막고 있는 삼목
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY]]
PLAYER1_5PATTERNS = [[PLAYER1, PLAYER1, PLAYER1, PLAYER1, PLAYER1], # 1. 오목
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY], # 6. 삼목
[EMPTY, PLAYER1, PLAYER1, PLAYER1, AI], # 10. 상대편 바둑돌이 막고 있는 삼목
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY]]
PLAYER1_4PATTERNS = [[EMPTY, PLAYER1, PLAYER1, EMPTY], # 11. 이목
[EMPTY, PLAYER1, PLAYER1, AI], # 12. 상대편 바둑돌이 막고 있는 이목
[AI, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, EMPTY]]
PLAYER1_7PATTERNS_SCORE = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, # 5.
2000, 2000, 2000, # 3.
1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000] # 4.
PLAYER1_6PATTERNS_SCORE = [100000, # 2.
25, 25, 25, 25, # 7.
50, 50, # 8.
5, 5, 5, 5, 5, 5, 5, 5] # 9.
PLAYER1_5PATTERNS_SCORE = [1000000, # 1.
1010, # 6.
3, 3, 3, 3] # 10.
PLAYER1_4PATTERNS_SCORE = [2, # 11.
1, 1, 1, 1] # 12.
AI_7PATTERNS = [[PLAYER1, AI, EMPTY, AI, AI, AI, PLAYER1], # 5. 양쪽에 상대편 바둑돌들이 막고있는 빈칸 하나 있는사목
[PLAYER1, AI, AI, EMPTY, AI, AI, PLAYER1],
[PLAYER1, AI, AI, AI, EMPTY, AI, PLAYER1],
[RED_STONE, AI, EMPTY, AI, AI, AI, PLAYER1],
[PLAYER1, AI, EMPTY, AI, AI, AI, RED_STONE],
[RED_STONE, AI, EMPTY, AI, AI, AI, RED_STONE],
[RED_STONE, AI, AI, EMPTY, AI, AI, PLAYER1],
[PLAYER1, AI, AI, EMPTY, AI, AI, RED_STONE],
[RED_STONE, AI, AI, EMPTY, AI, AI, RED_STONE],
[RED_STONE, AI, AI, AI, EMPTY, AI, PLAYER1],
[PLAYER1, AI, AI, AI, EMPTY, AI, RED_STONE],
[RED_STONE, AI, AI, AI, EMPTY, AI, RED_STONE],
[EMPTY, AI, EMPTY, AI, AI, AI, EMPTY], # 3. 빈칸 하나 있는 사목
[EMPTY, AI, AI, EMPTY, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, EMPTY, AI, EMPTY],
[EMPTY, AI, AI, AI, EMPTY, AI, PLAYER1], # 4. 상대편 바둑돌이 막고 있고 빈칸 하나 있는 사목
[EMPTY, AI, AI, EMPTY, AI, AI, PLAYER1],
[EMPTY, AI, EMPTY, AI, AI, AI, PLAYER1],
[PLAYER1, AI, AI, AI, EMPTY, AI, EMPTY],
[PLAYER1, AI, AI, EMPTY, AI, AI, EMPTY],
[PLAYER1, AI, EMPTY, AI, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, EMPTY, AI, RED_STONE],
[EMPTY, AI, AI, EMPTY, AI, AI, RED_STONE],
[EMPTY, AI, EMPTY, AI, AI, AI, RED_STONE],
[RED_STONE, AI, AI, AI, EMPTY, AI, EMPTY],
[RED_STONE, AI, AI, EMPTY, AI, AI, EMPTY],
[RED_STONE, AI, EMPTY, AI, AI, AI, EMPTY]]
AI_6PATTERNS = [[EMPTY, AI, AI, AI, AI, EMPTY], # 2. 사목
[EMPTY, AI, AI, AI, AI, PLAYER1], # 7. 상대편 바둑돌이 막고 있는 사목
[PLAYER1, AI, AI, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, AI, RED_STONE],
[RED_STONE, AI, AI, AI, AI, EMPTY],
[EMPTY, AI, EMPTY, AI, AI, EMPTY], # 8. 빈칸 있는 삼목
[EMPTY, AI, AI, EMPTY, AI, EMPTY],
[EMPTY, AI, AI, EMPTY, AI, PLAYER1], # 9. 빈칸 있고 상대편 바둑돌이 막고 있는 삼목
[EMPTY, AI, EMPTY, AI, AI, PLAYER1],
[PLAYER1, AI, EMPTY, AI, AI, EMPTY],
[PLAYER1, AI, AI, EMPTY, AI, EMPTY],
[EMPTY, AI, AI, EMPTY, AI, RED_STONE],
[EMPTY, AI, EMPTY, AI, AI, RED_STONE],
[RED_STONE, AI, EMPTY, AI, AI, EMPTY],
[RED_STONE, AI, AI, EMPTY, AI, EMPTY]]
AI_5PATTERNS = [[AI, AI, AI, AI, AI], # 1. 오목
[EMPTY, AI, AI, AI, EMPTY], # 6. 삼목
[EMPTY, AI, AI, AI, PLAYER1], # 10. 상대편 바둑돌이 막고 있는 삼목
[PLAYER1, AI, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, RED_STONE],
[RED_STONE, AI, AI, AI, EMPTY]]
AI_4PATTERNS = [[EMPTY, AI, AI, EMPTY], # 11. 이목
[EMPTY, AI, AI, PLAYER1], # 12. 상대편 바둑돌이 막고 있는 이목
[PLAYER1, AI, AI, EMPTY],
[EMPTY, AI, AI, RED_STONE],
[RED_STONE, AI, AI, EMPTY]]
AI_7PATTERNS_SCORE = [25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, # 5.
2000, 2000, 2000, # 3.
1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000, 1000] # 4.
AI_6PATTERNS_SCORE = [100000, # 2.
25, 25, 25, 25, # 7.
50, 50, # 8.
5, 5, 5, 5, 5, 5, 5, 5] # 9.
AI_5PATTERNS_SCORE = [1000000, # 1.
1010, # 6.
3, 3, 3, 3] # 10.
AI_4PATTERNS_SCORE = [2, # 11.
1, 1, 1, 1] # 12.
# 첫 번째 EMPTY에 착수하면 되는 끝내기 패턴
AI_ENDGAME_PATTERN1 = [[PLAYER1, AI, EMPTY, AI, AI, AI, PLAYER1], # 5. 양쪽에 상대편 바둑돌들이 막고있는 빈칸 하나 있는사목
[PLAYER1, AI, AI, EMPTY, AI, AI, PLAYER1],
[PLAYER1, AI, AI, AI, EMPTY, AI, PLAYER1],
[RED_STONE, AI, EMPTY, AI, AI, AI, PLAYER1],
[PLAYER1, AI, EMPTY, AI, AI, AI, RED_STONE],
[RED_STONE, AI, EMPTY, AI, AI, AI, RED_STONE],
[RED_STONE, AI, AI, EMPTY, AI, AI, PLAYER1],
[PLAYER1, AI, AI, EMPTY, AI, AI, RED_STONE],
[RED_STONE, AI, AI, EMPTY, AI, AI, RED_STONE],
[RED_STONE, AI, AI, AI, EMPTY, AI, PLAYER1],
[PLAYER1, AI, AI, AI, EMPTY, AI, RED_STONE],
[RED_STONE, AI, AI, AI, EMPTY, AI, RED_STONE],
[PLAYER1, AI, AI, AI, EMPTY, AI, EMPTY], # 4. 상대편 바둑돌이 막고 있고 빈칸 하나 있는 사목
[PLAYER1, AI, AI, EMPTY, AI, AI, EMPTY],
[PLAYER1, AI, EMPTY, AI, AI, AI, EMPTY],
[RED_STONE, AI, AI, AI, EMPTY, AI, EMPTY],
[RED_STONE, AI, AI, EMPTY, AI, AI, EMPTY],
[RED_STONE, AI, EMPTY, AI, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, AI, EMPTY], # 2. 사목
[EMPTY, AI, AI, AI, AI, PLAYER1], # 7. 상대편 바둑돌이 막고 있는 사목
[PLAYER1, AI, AI, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, AI, RED_STONE],
[RED_STONE, AI, AI, AI, AI, EMPTY]]
# 두 번째 EMPTY에 착수하면 되는 끝내기 패턴
AI_ENDGAME_PATTERN2 = [[EMPTY, AI, EMPTY, AI, AI, AI, EMPTY], # 3. 빈칸 하나 있는 사목
[EMPTY, AI, AI, EMPTY, AI, AI, EMPTY],
[EMPTY, AI, AI, AI, EMPTY, AI, EMPTY],
[EMPTY, AI, AI, AI, EMPTY, AI, PLAYER1], # 4. 상대편 바둑돌이 막고 있고 빈칸 하나 있는 사목
[EMPTY, AI, AI, EMPTY, AI, AI, PLAYER1],
[EMPTY, AI, EMPTY, AI, AI, AI, PLAYER1],
[EMPTY, AI, AI, AI, EMPTY, AI, RED_STONE],
[EMPTY, AI, AI, EMPTY, AI, AI, RED_STONE],
[EMPTY, AI, EMPTY, AI, AI, AI, RED_STONE]]
# 첫 번째 EMPTY에 착수하면 되는 필수 방어 패턴
AI_DEFENCE_PATTERN1 = [[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, AI], # 5. 양쪽에 상대편 바둑돌들이 막고있는 빈칸 하나 있는사목
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI],
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[AI, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY], # 4. 상대편 바둑돌이 막고 있고 빈칸 하나 있는 사목
[AI, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[AI, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[RED_STONE, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[RED_STONE, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, PLAYER1, AI], # 7. 상대편 바둑돌이 막고 있는 사목
[AI, PLAYER1, PLAYER1, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, PLAYER1, RED_STONE],
[RED_STONE, PLAYER1, PLAYER1, PLAYER1, PLAYER1, EMPTY]]
# 두 번째 EMPTY에 착수하면 되는 필수 방어 패턴
AI_DEFENCE_PATTERN2 = [[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY], # 3. 빈칸 하나 있는 사목
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, EMPTY],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, AI], # 4. 상대편 바둑돌이 막고 있고 빈칸 하나 있는 사목
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, AI],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, AI],
[EMPTY, PLAYER1, PLAYER1, PLAYER1, EMPTY, PLAYER1, RED_STONE],
[EMPTY, PLAYER1, PLAYER1, EMPTY, PLAYER1, PLAYER1, RED_STONE],
[EMPTY, PLAYER1, EMPTY, PLAYER1, PLAYER1, PLAYER1, RED_STONE]]