[Top][All Lists]
[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: |
Fri, 11 Jul 2003 01:16:03 +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:
> 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.
Here is a corresponding patch for twogtp. It also needs backwards
compatibility fixing.
- twogtp made GTP version 2 compliant
/Gunnar
Index: interface/gtp_examples/twogtp
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/gtp_examples/twogtp,v
retrieving revision 1.10
diff -u -r1.10 twogtp
--- interface/gtp_examples/twogtp 10 Jul 2003 13:06:53 -0000 1.10
+++ interface/gtp_examples/twogtp 10 Jul 2003 23:12:00 -0000
@@ -110,9 +110,9 @@
my $cmd;
if ($color =~ /^b/i) {
- $cmd = "genmove_black";
+ $cmd = "genmove black";
} elsif ($color =~ /^w/i) {
- $cmd = "genmove_white";
+ $cmd = "genmove white";
} else {
die "Illegal color $color\n";
}
@@ -123,14 +123,14 @@
my $self = shift;
my $move = shift;
- GTP::exec_cmd($self->{in}, $self->{out}, "black $move");
+ GTP::exec_cmd($self->{in}, $self->{out}, "play black $move");
}
sub white {
my $self = shift;
my $move = shift;
- GTP::exec_cmd($self->{in}, $self->{out}, "white $move");
+ GTP::exec_cmd($self->{in}, $self->{out}, "play white $move");
}
sub komi {
@@ -147,6 +147,12 @@
GTP::exec_cmd($self->{in}, $self->{out}, "boardsize $size");
}
+sub clear_board {
+ my $self = shift;
+
+ GTP::exec_cmd($self->{in}, $self->{out}, "clear_board");
+}
+
sub handicap {
my $self = shift;
my $handicap = shift;
@@ -202,10 +208,10 @@
return GTP::exec_cmd($self->{in}, $self->{out}, "score");
}
-sub estimate_score {
+sub final_score {
my $self = shift;
- my $ret = GTP::exec_cmd($self->{in}, $self->{out}, "estimate_score");
+ my $ret = GTP::exec_cmd($self->{in}, $self->{out}, "final_score");
my ($result, $rest) = split(' ', $ret, 2);
return $result;
}
@@ -298,10 +304,12 @@
print "Setting boardsize and komi for black\n" if $verbose;
$self->black->boardsize($size);
+ $self->black->clear_board();
$self->black->komi($komi);
print "Setting boardsize and komi for white\n" if $verbose;
$self->white->boardsize($size);
+ $self->white->clear_board();
$self->white->komi($komi);
my $pass = 0;
@@ -387,8 +395,8 @@
$resultb = $toplay eq 'B' ? 'B+R' : 'W+R';
$resultw = $resultb;
} else {
- $resultw = $self->white->estimate_score;
- $resultb = $self->black->estimate_score;
+ $resultw = $self->white->final_score;
+ $resultb = $self->black->final_score;
}
if ($resultb eq $resultw) {
print "Result: $resultw\n";