I have been writing a gui with python which hosts katago and shows moves. This is for children beginners to play go so that its strength should be 30k - 20k. One task is to simulate the followings:
katago gtp -config gtp_human5k_example.cfg -model network.bin.gz -human-model b18c384nbt-humanv0.bin.gz
It is not hard to implement this one with python subprocess, but the default boardsize is 19. 19x19 board is too big for children. after initialzing trying to set boardsize 9 cause hanging. What causes hanging?
def send_command_boardsize(self, command):
"""Send the boardsize command and log all output."""
if self.process.poll() is not None:
print("Engine process has terminated.")
return None
print(f"Sending command: {command}")
try:
self.process.stdin.write(command + "\n")
self.process.stdin.flush()
except OSError as e:
print(f"Error sending command '{command}': {e}")
return None
response_lines = []
while True:
line = self.process.stdout.readline().strip()
if line:
print(f"Received line: {line}") # Log each line
response_lines.append(line)
if line == "=": # Stop reading when the final confirmation is received
break
return "\n".join(response_lines)