gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] trevor_1_14.7


From: Trevor Morris
Subject: [gnugo-devel] trevor_1_14.7
Date: Sun, 18 Nov 2001 00:10:13 -0500

http://www.public32.com/games/go/trevor_1_14.7

 - regress.pl records sgf trace for owl_attack & owl_defend.
 - regress.plx provides access to sgf trace files if present.

Index: regression/regress.pl
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/regress.pl,v
retrieving revision 1.11
diff -u -r1.11 regress.pl
--- regression/regress.pl       2001/11/15 16:18:40     1.11
+++ regression/regress.pl       2001/11/18 04:24:08
@@ -154,8 +154,8 @@
   exit;
 }
 
+my $s = (lc ($^O) eq 'mswin32') ? '\\' : '/';
 if (!$goprog) {
-  my $s = (lc ($^O) eq 'mswin32') ? '\\' : '/';
   $goprog = "..${s}interface${s}gnugo.exe --mode gtp --quiet -t -w
-d0x1000";  
 }
 
@@ -220,7 +220,7 @@
 my $file_count = 0;
 while ($file_count <= $#ARGV) {
   $curtstfile = $ARGV[$file_count];
-  unlink "html/index.html";
+  #unlink "html/index.html";
   unlink "html/$curtstfile/index.html";
   print "regressing file $ARGV[$file_count]\n" if $verbose > 1;
   unlink "html/$curtstfile/index.html";
@@ -249,6 +249,7 @@
   -e "html/$testfile" or mkdir "html/$testfile" or die "Couldn't create
html/$testfile";
   
   my $childpid;
+
   unless ($one_gg_process) {
     $goprog_in  = new FileHandle;              # stdin of computer player
     $goprog_out = new FileHandle;              # stdout of computer player
@@ -275,14 +276,14 @@
       }
       close TRACER;
       exit;
-  }
+    }
   }
-  
+
   foreach (@counters) {
     go_command("reset_${_}_counter");
     eat();
   }
-
+  
   #main bit.
   $pidt = open ($testfile_out,"<$testfile");
   print "testfile pid: $pidt\n" if $verbose > 1;
@@ -367,6 +368,8 @@
       }
     }
     if (defined($next_cmd)) {
+      $next_cmd =~ /^([0-9]+)/;
+      my $this_number = $1;
       if (!$skipping) {
        $top_moves = "";
        if ($do_topmove) {
@@ -375,6 +378,10 @@
            $top_moves = 1;
          }
        }
+       if (defined($this_number) && $next_cmd =~ /owl_(attack|defend)/) {
+         go_command("start_sgftrace");
+         eat(); #ignore output
+       }
        go_command($next_cmd); 
        if ($top_moves) {
          $top_moves = eat_one();
@@ -390,9 +397,12 @@
          if (!defined($result)) {$result="";}
        }
        print "RES: $result\n" if $verbose > 1;
+       if (defined($this_number) && $next_cmd =~ /owl_(attack|defend)/) {
+         go_command("finish_sgftrace html$s$testfile$s$this_number.sgf");
+         eat(); #ignore output
+       }
       }
-      $next_cmd =~ /^([0-9]+)/;
-      if ($1) {$num = $1;}
+      if (defined $this_number) {$num = $this_number;}
     }
   }
   my $pass_string;
@@ -725,15 +735,15 @@
   
   return "<BOARD size=$boardsize>\n" . $xboard . "</BOARD>\n";
 }
-  
 
+
 sub eat() {
   # ignore empty lines
-    my $line = "";
-    while ($line eq "") {
+  my $line = "";
+  while ($line eq "") {
     chop($line = <$goprog_out>) or confess "No response!";
     $line =~ s/\s*$//smg;
-    }
+  }
   <$goprog_out>;
   return $line;
 }  
Index: regression/regress.plx
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/regress.plx,v
retrieving revision 1.5
diff -u -r1.5 regress.plx
--- regression/regress.plx      2001/11/16 20:16:03     1.5
+++ regression/regress.plx      2001/11/18 04:24:11
@@ -92,7 +92,7 @@
   print "bad test file: $tstfile\n";
   exit;
 }
-
+ 
 if ($reset) {
   unlink glob("html/*.html");# or die "couldn't delete html files: $!";
   unlink glob("html/*/*.html");# or die "couldn't delete html/* files: $!"; 
@@ -165,7 +165,7 @@
   #our $VAR1;
   #do "html/one.perldata" or confess "can't do perldata";
   #my %h = %{$VAR1->[0]};
-  
+
 
   open I, ">html/index.html";
 
@@ -215,25 +215,25 @@
     }
     push @{$subTotHash{$h{$k1}{status}}}, $h{$k1}{num};
   }
-
+  
       #direct copy from above - don't miss last time through - HACK!  
         if ($curfile ne "") {
         #New file = print old totals
         print I qq@<TR>\n <TD><A
href="?tstfile=$curfile&sortby=result">$curfile</A></TD>\n@;
-    foreach my $k2 (@pflist) {
+        foreach my $k2 (@pflist) {
           my $c = @{$subTotHash{$k2}};  #i.e. length of array.
           if ($k2 !~ /passed/ and $c) {
-        print I " <TD>$c:<BR>\n";
+            print I " <TD>$c:<BR>\n";
             foreach (sort {$a<=>$b} @{$subTotHash{$k2}}) {
               print I qq@  <A HREF="?$curfile:$_">$_</A>\n@;
+            }
+            print I " </TD>\n";
+          } else {
+            print I " <TD>$c</TD>\n";
+          }
         }
-        print I " </TD>\n";
-      } else {
-        print I " <TD>$c</TD>\n";
-      }
-    }
         print I qq@</TR>@;
-  }
+      }
 
   
   print I "<TR>\n <TD><B>Total</B></TD>\n";
@@ -265,12 +265,22 @@
 
 if ($num) {
 #CASE 2 - problem detail.
+
+  if ($sgf && -e "html/$tstfile/$num.sgf") {
+    open (SGFFILE, "html/$tstfile/$num.sgf") or confess "couldn't open file";
+    while (<SGFFILE>) {
+      print;
+    }
+    close SGFFILE;
+    exit;
+  }
+
   open (FILE, "html/$tstfile/$num.xml");
   local $/; undef($/);
   my $content = <FILE>;
   close FILE;
   my %attribs = %{game_parse($content)};
-  
+
   if ($sgf) {
     sgfFile(%attribs);
     exit;
@@ -349,7 +359,7 @@
   $colorboard .= "\n</TABLE>\n";
 
   print $colorboard;
-  
+ 
   my $gtpall = $attribs{gtp_all};
   $gtpall  =~ s/<BR>//mg;
   $gtpall  =~ s/\s+$//mg;
@@ -718,4 +728,4 @@
     print "</TABLE>\n";
     print "</body></html>\n";
     
-}
+}
\ No newline at end of file





reply via email to

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