sjz commited on
Commit
70d6bef
1 Parent(s): 16e10ba

fix ai aid bug

Browse files
Files changed (1) hide show
  1. pages/Player_VS_AI.py +3 -2
pages/Player_VS_AI.py CHANGED
@@ -270,7 +270,8 @@ def gomoku():
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]]
276
  top_five_probs = [prob for act, prob in sorted_acts_probs[:5]]
@@ -394,7 +395,7 @@ def gomoku():
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
 
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
+ copy_mcts = deepcopy(session_state.ROOM.MCTS.mcts)
274
+ _, acts, probs, simul_mean_time = copy_mcts.get_move_probs(session_state.ROOM.BOARD)
275
  sorted_acts_probs = sorted(zip(acts, probs), key=lambda x: x[1], reverse=True)
276
  top_five_acts = [act for act, prob in sorted_acts_probs[:5]]
277
  top_five_probs = [prob for act, prob in sorted_acts_probs[:5]]
 
395
  for j, cell in enumerate(row):
396
  BOARD_PLATE[i][j].write(
397
  _PLAYER_SYMBOL[cell],
398
+ # key=f"{i}:{j}",
399
  )
400
 
401
  # Game process control