Spaces:
Sleeping
Sleeping
sjz
commited on
Commit
•
16e10ba
1
Parent(s):
9cefce7
fix game-over bug
Browse files- pages/Player_VS_AI.py +5 -12
pages/Player_VS_AI.py
CHANGED
@@ -269,7 +269,7 @@ def gomoku():
|
|
269 |
# Draw board
|
270 |
def draw_board(response: bool):
|
271 |
"""construct each buttons for all cells of the board"""
|
272 |
-
if session_state.USE_AIAID:
|
273 |
_, acts, probs, simul_mean_time = session_state.ROOM.MCTS.mcts.get_move_probs(session_state.ROOM.BOARD)
|
274 |
sorted_acts_probs = sorted(zip(acts, probs), key=lambda x: x[1], reverse=True)
|
275 |
top_five_acts = [act for act, prob in sorted_acts_probs[:5]]
|
@@ -392,17 +392,10 @@ def gomoku():
|
|
392 |
print("Game over")
|
393 |
for i, row in enumerate(session_state.ROOM.BOARD.board_map):
|
394 |
for j, cell in enumerate(row):
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
key=f"{i}:{j}",
|
400 |
-
)
|
401 |
-
else:
|
402 |
-
BOARD_PLATE[i][j].write(
|
403 |
-
_PLAYER_SYMBOL[cell],
|
404 |
-
key=f"{i}:{j}",
|
405 |
-
)
|
406 |
|
407 |
# Game process control
|
408 |
def game_control():
|
|
|
269 |
# Draw board
|
270 |
def draw_board(response: bool):
|
271 |
"""construct each buttons for all cells of the board"""
|
272 |
+
if session_state.USE_AIAID and session_state.ROOM.WINNER == _BLANK:
|
273 |
_, acts, probs, simul_mean_time = session_state.ROOM.MCTS.mcts.get_move_probs(session_state.ROOM.BOARD)
|
274 |
sorted_acts_probs = sorted(zip(acts, probs), key=lambda x: x[1], reverse=True)
|
275 |
top_five_acts = [act for act, prob in sorted_acts_probs[:5]]
|
|
|
392 |
print("Game over")
|
393 |
for i, row in enumerate(session_state.ROOM.BOARD.board_map):
|
394 |
for j, cell in enumerate(row):
|
395 |
+
BOARD_PLATE[i][j].write(
|
396 |
+
_PLAYER_SYMBOL[cell],
|
397 |
+
key=f"{i}:{j}",
|
398 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
399 |
|
400 |
# Game process control
|
401 |
def game_control():
|