Skip to content

Commit b3a3c5a

Browse files
committed
일단 돌아는 가게 수정...
1 parent 5c32701 commit b3a3c5a

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ai_team_TNK.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def generate_json(prefix, my_position, your_position):
8585

8686
# json파일로 저장
8787
stone["index"] = my_idx
88-
stone["positions"] = {'my':[], 'your':[]}
88+
stone["positions"] = {'my': [], 'your': []}
8989
stone["strength"] = []
9090

9191
#현재 위치 json에 추가
@@ -208,6 +208,7 @@ def get_high_score_cases(filenames, count):
208208
with open(str(filename)) as json_file:
209209
json_data = json.load(json_file)
210210

211+
priority = 0
211212
for i in range(len(json_data['result'])):
212213
# 내 남은 돌의 개수 계산
213214
my_stones = len(json_data['result'][i]['my'])
@@ -224,24 +225,26 @@ def get_high_score_cases(filenames, count):
224225
# stone_info 에 튜플 형태로 힙 push
225226
heapq.heappush(stone_info, (
226227
(-1) * int(score), # 점수
228+
priority,
227229
json_data['index'], # 돌 번호
228230
json_data['strength'][i]['x'], # 돌의 x 세기
229231
json_data['strength'][i]['y'], # 돌의 y 세기
230232
json_data['result'][i]['my'], # 내 돌의 포지션
231233
json_data['result'][i]['your'], # 상대 돌의 포지션
232234
)
233235
)
236+
priority += 1
234237

235238
cases = []
236239

237240
for i in range(0,count):
238241
tmp = heapq.heappop(stone_info)
239242

240-
my_positions = list(map(lambda position: [position['x'], position['y']], tmp[4]))
241-
your_positions = list(map(lambda position: [position['x'], position['y']], tmp[5]))
243+
my_positions = list(map(lambda position: [position['x'], position['y']], tmp[5]))
244+
your_positions = list(map(lambda position: [position['x'], position['y']], tmp[6]))
242245
positions = [my_positions, your_positions]
243246

244-
case = Case(tmp[0] * (-1), [tmp[2], tmp[3]], positions, tmp[1])
247+
case = Case(tmp[0] * (-1), [tmp[3], tmp[4]], positions, tmp[2])
245248
cases.append(case)
246249

247250
return cases

alggago.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
WIDTH, HEIGHT = 1000, 700
1111
TICK = 1.0/60.0
12-
NUM_STONES = 7
12+
NUM_STONES = 3
1313
PLAYER_COLOR = ["black", "white"]
1414
STONE_DIAMETER = 50
1515
RESTITUTION = 0.9

0 commit comments

Comments
 (0)