gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] crash in twogtp


From: Gunnar Farneback
Subject: Re: [gnugo-devel] crash in twogtp
Date: Thu, 10 Jul 2003 00:46:46 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/20.7 (sparc-sun-solaris2.7) (with unibyte mode)

I wrote:
> Bernard wrote:
> > I have a problem with the perl script twogtp. Depending on the version 
> > of perl, it may crash.
> > 
> > address@hidden ~/tmp/gnugo-3.3.21$ perl interface/gtp_examples/twogtp 
> > --white 
> > "interface/gnugo --mode gtp" --black "interface/gnugo --mode gtp" --games 1
> > Can't use an undefined value as a SCALAR reference at 
> > interface/gtp_examples/twogtp line 103.
> > address@hidden ~/tmp/gnugo-3.3.21$ perl --version
> > 
> > This is perl, v5.8.0 built for i386-linux-thread-multi
> > 
> > I have been able to make twogtp work using perl version 5.005_03.

After some discussions on NNGS Evan has found the source of this
problem and will send in a patch.

> Do we have any perl experts on board? The perl versions of twogtp seem
> to need some shaping up before 3.4. In addition to the problem above
> they should also be made aware of GTP version 2. (If someone who wants
> to work with this knows perl but not the protocol issues I can
> describe what needs to be done for GTP version 2 compliance.)

The appended patch makes twogtp-a GTP version 2 compliant. It's not
backwards compatible though. This can easily be solved with help of
the protocol_version command, but it takes more perl knowledge than I
have. Evan has promised to fix this too.

A remaining problem is that both twogtp and twogtp-a don't work
properly with --verbose 2 for current versions of GNU Go. The reason
is that the showboard command has been changed to return the board on
stdout (the GTP channel) instead of writing it to stderr. This should
also be easy to fix for someone who knows perl.

The patch also includes a minor revision of gtp_examples/README.

- twogtp.py and twogtp.pike addedotp gtp_examples/README
- twogtp-a made GTP version 2 compliant

/Gunnar

Index: interface/gtp_examples/README
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/gtp_examples/README,v
retrieving revision 1.7
diff -u -r1.7 README
--- interface/gtp_examples/README       22 Nov 2001 15:29:29 -0000      1.7
+++ interface/gtp_examples/README       9 Jul 2003 22:28:29 -0000
@@ -4,6 +4,10 @@
 
 twogtp-a  : alternative implementation
 
+twogtp.py : Python version of twogtp with additional features.
+
+twogtp.pike : Pike version of twogtp with even more features.
+
 2ptkgo.pl : Requires perltk and the next program. Plays two gtp processes 
             together with graphical display
 
Index: interface/gtp_examples/twogtp-a
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/gtp_examples/twogtp-a,v
retrieving revision 1.10
diff -u -r1.10 twogtp-a
--- interface/gtp_examples/twogtp-a     29 Oct 2002 14:41:17 -0000      1.10
+++ interface/gtp_examples/twogtp-a     9 Jul 2003 22:28:29 -0000
@@ -166,11 +166,15 @@
 
     print $black_in  "boardsize $size\n";
     eat_no_response($black_out);
+    print $black_in  "clear_board\n";
+    eat_no_response($black_out);
     print $black_in  "komi $komi\n";
     eat_no_response($black_out);
 
     print $white_in  "boardsize $size\n";
     eat_no_response($white_out);
+    print $white_in  "clear_board\n";
+    eat_no_response($white_out);
     print $white_in  "komi $komi\n";
     eat_no_response($white_out);
     
@@ -195,7 +199,7 @@
     }
     while ($pass < 2) {
        if ($toplay eq 'B') {
-           print $black_in "genmove_black\n";
+           print $black_in "genmove black\n";
            $move = eat_move($black_out);
            $sgfmove = standard_to_sgf($move);
            print SGFFILEHANDLE ";B[$sgfmove]\n" if defined $sgffilename;
@@ -205,7 +209,7 @@
            } else {
                $pass = 0;
            }
-           print $white_in "black $move\n";
+           print $white_in "play black $move\n";
            eat_no_response($white_out);
            if ($verbose > 1) {
                print $white_in "showboard\n";
@@ -213,7 +217,7 @@
            }
            $toplay = 'W';
        } else {
-           print $white_in "genmove_white\n";
+           print $white_in "genmove white\n";
            $move = eat_move($white_out);
            $sgfmove = standard_to_sgf($move);
            print SGFFILEHANDLE ";W[$sgfmove]\n" if defined $sgffilename;
@@ -223,7 +227,7 @@
            } else {
                $pass = 0;
            }
-           print $black_in "white $move\n";
+           print $black_in "play white $move\n";
            eat_no_response($black_out);
            if ($verbose > 1) {
                print $black_in "showboard\n";
@@ -232,10 +236,10 @@
            $toplay = 'B';
        }
     }
-    print $white_in "estimate_score\n";
+    print $white_in "final_score\n";
     $resultw = eat_score($white_out);
     print "Result according to W: $resultw\n";
-    print $black_in "new_score\n";
+    print $black_in "final_score\n";
     $resultb = eat_score($black_out);
     print "Result according to B: $resultb\n";
     print $white_in "quit\n";




reply via email to

[Prev in Thread] Current Thread [Next in Thread]