akigo wrote:
According to KataGo's GTP extensions, it always sends several messages of type (a), then one message of type (b). Then everything works fine.
I suspect, that in this special moment (due to the hickup you observed) a message of type (a) was sent (or received) after the message of type (b). Since the message of type (b) was consumed first, it was already black's move when the trailing message of type (a) was interpreted. So the high winrate was attributed to the wrong side.
This should be a very rare exception (I never had this on my test device). Nevertheless I will check if I can enhance the code to detect such kind of disorder and react accordingly.
I don't actually see currently in the code how it could happen - the code is written with the intent that this should never be the case - the thread that loops and produces this callback is terminated and explicitly waited on (thread.join) by the code that proceeds to conclude the response to the gtp command. It's possible there is a sneaky bug in that code, but I currently don't see it.
Are you using 'kata-analyze' followed by 'play' in that situation or are you using 'genmove-analyze' in that situation? And do you always wait for the double newline that signals the end of the gtp response? Keep in mind that gtp input and output can be arbitrary out of order - you are free to tell KataGo to 'play' a move in the middle of while it's doing a 'kata-analyze' or some other thing, and even send multiple other commands - making the input far ahead of the output. And you are free to make your GUI update its own state far ahead of where KataGo's output has caught up to at that point, if your GUI is capable of handling the asynchronousness, but the output should still process commands in the order received, outputting the normal '=' and double-newline for each one, as it catches up.
If you can give me a log where the output happens out of order where I can see the sequence of commands that triggered it, then I can try to dig into it using that command sequence as a guide.