diff --git a/core/engine.py b/core/engine.py index efeee83..5fb6915 100644 --- a/core/engine.py +++ b/core/engine.py @@ -113,7 +113,7 @@ class KataGoEngine: query["id"] = f"QUERY:{str(self.query_counter)}" self.queries[query["id"]] = (callback, error_callback, time.time(), next_move) if self.katago_process: - self.katrain.log(f"Sending query {query['id']}: {str(query)}", OUTPUT_DEBUG) + self.katrain.log(f"Sending query {query['id']}: {json.dumps(query)}", OUTPUT_DEBUG) try: self.katago_process.stdin.write((json.dumps(query) + "\n").encode()) self.katago_process.stdin.flush() diff --git a/core/sgf_parser.py b/core/sgf_parser.py index cf39d03..c3e59b9 100644 --- a/core/sgf_parser.py +++ b/core/sgf_parser.py @@ -9,7 +9,7 @@ class ParseError(Exception): class Move: - GTP_COORD = list("ABCDEFGHJKLMNOPQRSTUVWXYZ") + ["A" + c for c in "ABCDEFGHJKLMNOPQRSTUVWXYZ"] # kata board size 29 support + GTP_COORD = list("ABCDEFGHJKLMNOPQRSTUVWXYZ") + [xa + c for xa in "AB" for c in "ABCDEFGHJKLMNOPQRSTUVWXYZ"] # kata board size 29 support PLAYERS = "BW" SGF_COORD = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ".lower()) + list("ABCDEFGHIJKLMNOPQRSTUVWXYZ") @@ -212,15 +212,17 @@ class SGFNode: @property def next_player(self): - if "B" in self.properties or "AB" in self.properties: + if "B" in self.properties or "AB" in self.properties: # root or black moved return "W" - return "B" + else: + return "B" @property def player(self): - if "W" in self.properties: - return "W" - return "B" + if "B" in self.properties or "AB" in self.properties: + return "B" + else: + return "W" # nb root is considered white played if no handicap stones are placed class SGF: diff --git a/gui/popups.py b/gui/popups.py index bb9e8dd..888d5d3 100644 --- a/gui/popups.py +++ b/gui/popups.py @@ -173,13 +173,12 @@ class ConfigPopup(QuickConfigGui): old_proc = old_engine.katago_process if old_proc: old_engine.shutdown(finish=True) - new_engine = KataGoEngine(self.katrain, self.config["engine"]) self.katrain.engine = new_engine self.katrain.game.engines = {"B": new_engine, "W": new_engine} if not old_proc: self.katrain.game.analyze_all_nodes() # old engine was broken, so make sure we redo any failures - + self.katrain.update_state() Clock.schedule_once(restart_engine, 0) self.katrain.debug_level = self.config["debug"]["level"]