[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [computer-go] GTP and Tourney in SmartGo 1.4




GMP interfaces at the serial port, which is a hardware thing, not an OS thing. GTP
seems to want pipes, which is an OS thing, and makes it difficult for windows programmers.

Prior tournaments generally were agnostic about the computer and OS, since the only
requirement was a serial port, or having the author type in moves.

I worry that a GMP tournament would require Linux and run both programs on the same
machine, connected by GTP over pipes. I think that would be a step back :)

David

At 01:54 PM 3/12/2004 -0500, you wrote:

This is turning into an OS thing,  but I thought it was about GMP vs GTP?
How does GMP figure in?   Is that natural and easy compared to this?

- Don



   Hi, before this "big debate" started (I only get summaries) I did try to
   make some attempt to connect my program viking4 yesterday using kgsGTP
   by William Shubert. Since the debate sofar has not been so constructive
   I might add some real experience as a programmer who want to use GTP but
   do not have a clue of how.

   My problems was a) I am using Windows b) I am programming in Delphi
   (that is Object Pascal).

   I got some hints how to do things right by Anders Kierulf (thx a lot!),
   but it looked very complicated, therefore...

   My first attempt was to make a console application in Delphi, which in
   theory would be extremely easy. kgsGTP would then start my program and
   communicate with stdin, stdout of the console. The problem was that this
   did not work. Nothing happened and I gave up.

   Reading the hints from A.K again I suspected that this simple approach
   might not work out that easily, and anyway I would prefer to use a
   non-console approach.

   Thus I turned into named pipes and had to read Windows API help files
   that are really scary when you are used to the nice encapsulation Delphi
   provides for almost every task in Windows except: pipes...

   I opened two pipes (providing the pipenames to kgsgtp in the parameter
   file) and tried to read from them but nothing happened.

   The logs from kgsGTP just seemed to confirm this.

   I then realized that pipe in windows has to be named in a special way
   like this (this is not included in the helpfile that describes the
   function you use to create a named pipe...):
   "\\.\pipe\myowncutepipename"

   I tried that and nothing happened. Then by chance I saw a snippet of c++
   code that created a named pipe and it looked like this.

   "\\\\.\\pipe\\myowncutepipename"

   Apparently c++ has a special meaning for \ and uses \\ to get away with
   this. (it was over 10 years I did some c++ programming). Cleverly I
   realized that kgsGTP that uses java probably suffers from this problem
   since java is similar to c++. Providing the pipenames to kgsgtp in
   c++-format made the error messages in the log og kgsgtp go away! It
   seemed as if there was a connection.

   After that I tried to read from my pipe, using both Delphi low-level
   procedures and the Windows API but what happened, was that the program
   could see there were 14 bytes to be read, but the read operation itself
   blew up the program and buffer was filled with crap. I have no idea of
   what went wrong.

   ....

   But there are good news. I returned to the console idea. The problem
   with the console is that when it is started from kgsgtp, there is even
   no console so the only means of knowing what happens is to log things to
   a file. My mistake was that nothing goes to the file itself unless the
   file is closed, and this never happened in my simple test program. So I
   just changed all Writes to the log file into a) open file/append b)
   Write a line c) Close file. And suddenly this appeared:

   "
   Start Log
   list_commands
   "

   The list_commands thing comes from kgsgtp. And it is 14 bytes (see
   above) long which seems to prove that the named pipe solution works as
   well. It is just me who cannot read those bytes from pipe correctly.
   Finally success!

   Ok, so do I have an important message?

   It is possible to use gtp in windows. But!

   The pipe thing is scary to window programmers!!!!! All of the gtp
   documentation I have seen so far assumes that using pipes is as natural
   as brushing your teeth. It may be so for UNIX-programmers but for some
   other poor unfortunate people this is not the case. And to make it
   worse, every time something do not work, there are no clues whatsoever
   where problem is.
   Debugging within a program is much simpler than this.

   You need to make it clear how to do it in Windows. It took me perhaps 6
   hours of experimentation and searching for information about pipe
   programming and a mix of bad and good luck before I even saw some hope
   of transferring a single byte between two programs. I might be unusually
   incompetent as a programmer, but I do others could repeat exactly the
   same errors as I did.

   In contrast it took me perhaps 15 minutes, with no prior knowledge in
   clientprogramming to write a rudimentary telnet-client to nngs using
   Delphi. In that case it was simple because there was a simple
   socketinterface and proper documentation on how to use it.

   --
   Magnus Persson
   Center for Adaptive Behavior and Cognition

   -----Original Message-----
   From: David Fotland [mailto:fotland@xxxxxxxxxxxxxxxxx]


   What about those of use with Windows programs?  If there a referee that
   can talk to windows programs?  Is there any standard for how to set up
   the
   Windows pipe involved (presumably some named pipe), since you can't
   do it form the command line like under Unix?


   _______________________________________________
   computer-go mailing list
   computer-go@xxxxxxxxxxxxxxxxx
   http://computer-go.org/mailman/listinfo/computer-go

_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://computer-go.org/mailman/listinfo/computer-go

_______________________________________________
computer-go mailing list
computer-go@xxxxxxxxxxxxxxxxx
http://computer-go.org/mailman/listinfo/computer-go