I just went through the process of getting my engine (Gonzo) up and
running on CGOS.  I thought I'd share the experience as it wasn't
exactly plain sailing and others who may encounter similar problems in
the future may benefit.

My engine is written in Java and I run it from a Windows box.  When I
tried using the TCL CGOS client I had no joy at all - the pipe between
the client and the engine just didn't seem to be working.  No idea why
but if I had to bet I'd say it was an issue with the way TCL uses
pipes.

As a sanity test I wrote a little Python program that started my
engine and communicated with it via a pipe.  This worked fine, which
gave me an idea: write a proxy to sit between the client and my
engine.  I did that and it works perfectly - Gonzo could at last play
games on CGOS.

Source code (Python) for the proxy is below in case anyone finds it useful:


# A simple proxy between the GCOS client and a Go engine.
# Written because it seems the CGOS client has trouble communicating
# with a Java process (on Windows at least).

from popen2 import popen2
import sys

# Start the Go engine.
output, input = popen2('java -classpath c:\peter\gonzo039 GTPInterface')

while 1:
  # Get a command from the client and send it to the engine.
  from_client = sys.stdin.readline()
  input.write(from_client)
  input.flush()

  # Get a response from the engine and send it to the client.
  while 1:
    from_engine = output.readline()
    sys.stdout.write(from_engine)
    if from_engine == '\n': break
  sys.stdout.flush()


That's all,
Peter
_______________________________________________
computer-go mailing list
[email protected]
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to