gtp to 52, debug json in json
This commit is contained in:
1 parent
eef08ed96e
commit
de16348084
3 files changed
+10
-9
No files matched your search
+1
-1
@@ -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()
|
||||
|
||||
+8
-6
@@ -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:
|
||||
|
||||
+1
-2
@@ -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"]
|
||||
|
||||
Reference in new issue
Block a user