diff --git a/board.py b/board.py index 0aad671..af03134 100644 --- a/board.py +++ b/board.py @@ -322,7 +322,12 @@ class Board: and (move.evaluation_info[0] or 0.0) < train_settings["sgf_show_best_move_threshold"] and prev_move.analysis[0]["move"] != move.gtp() ): - best_sq = f"SQ[{Move(gtpcoords=prev_move.analysis[0]['move'], player=0).sgfcoords(self.board_size)}]" + best_sq = "".join( + f"SQ[{Move(gtpcoords=mv['move'], player=0).sgfcoords(self.board_size)}]" + for mv in prev_move.analysis + if move.player_sign * mv["scoreLead"] >= move.player_sign * prev_move.analysis[0]["scoreLead"] - 0.5 + and mv["visits"] >= train_settings["balance_play_min_visits"] + ) else: best_sq = "" return move.sgf(self.board_size) + f"C[{move.comment(sgf=True)}]{undo_cr}{best_sq}" diff --git a/controller.py b/controller.py index f4bef8f..a238f97 100644 --- a/controller.py +++ b/controller.py @@ -130,7 +130,7 @@ class EngineControls(GridLayout): time.sleep(0.05) # select move current_move = self.board.current_move - pos_moves = [(d["move"], float(d["scoreMean"]), d["evaluation"]) for d in current_move.ai_moves if int(d["visits"]) >= ts["balance_play_min_visits"]] + pos_moves = [(d["move"], float(d["scoreLead"]), d["evaluation"]) for d in current_move.ai_moves if int(d["visits"]) >= ts["balance_play_min_visits"]] sel_moves = pos_moves[:1] # don't play suicidal to balance score - pass when it's best if self.ai_balance.active and pos_moves[0][0] != "pass":