[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] Re: regress.plx
From: |
ab |
Subject: |
[gnugo-devel] Re: regress.plx |
Date: |
Wed, 28 Jul 2004 14:33:59 +0200 |
Gunnar Farnebäck wrote:
>> "change layout of regression views a bit to be viewable on one screen
>> (1024x768)"...
>> if you have time, integrate this into regress.plx...
>Your best chance to get any such change in is to create a patch
>against regress.plx. I don't think we have anybody around who's both
>active and familiar with that code.
>
>If you make yourself familiar with the code we have some more small
>things which would need fixing. :-)
ok, I have it, however I'm not familiar with the code, just the lines which I
rearranged and
changed a bit...
tested & carefully edited, here are the lines:
==================regress.plx=====================
if ($num) {
#CASE 2 - problem detail.
if ($sgf && -e "html/$tstfile.tst/$num.sgf") {
open (SGFFILE, "html/$tstfile.tst/$num.sgf") or confess "couldn't open
file";
while (<SGFFILE>) {
print;
}
close SGFFILE;
exit;
}
open (FILE, "html/$tstfile.tst/$num.xml") or die "couldn't open xml file\n";
local $/; undef($/);
my $content = <FILE>;
close FILE;
my %attribs = %{game_parse($content, 1)};
if ($sgf) {
foreach (sort keys %attribs) {
# print "$_: $attribs{$_}\n";
}
sgfFile(%attribs);
exit;
}
# head
print qq@<HTML><HEAD>
<TITLE>$tstfile:$num details.</TITLE>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
</HEAD><BODY>\n@;
# 2 nested tables, left board, right info
print qq@<TABLE><TR><TD> @;
my $boardsize = $attribs{"boardsize"}; #need to add to export.
my $colorboard;
$colorboard .= "<TABLE border=0 cellpadding=0 cellspacing=0>\n"
. colorboard_letter_row($boardsize). "\n";
for (my $j = $boardsize; $j > 0; $j--) {
my $jA = $j;
$jA .= " " if ($j <= 9);
$colorboard .= " <TR>\n <TD align=center
valign=center> $j </TD>\n";
for (my $i = 1; $i <= $boardsize; $i++) {
my $iA = ord('A') + $i - 1;
if ($iA >= ord('I')) { $iA++; }
$iA = chr($iA);
my $coord = $iA.$j;
my $bw = pval($coord, "stone");
my $img_pix_size = 25;
my $dragonletter = pval($coord, "dragon_letter");
my $dragoncolor = $colors{pval($coord, "dragon_status")};
my $owlcolor = $colors{pval($coord, "owl_status")};
my $owlletter = $dragonletter;
my $alt = "";
my ($markcolor, $known, $try) = ("", pval($coord, "known"), pval($coord,
"try"));
$markcolor = "magenta" if ($known and $known eq "wrong");
$markcolor = "green" if ($known and $known eq "right");
$markcolor = "cyan" if ($try and $try eq "right");
$markcolor = "red" if ($try and $try eq "wrong");
my $question = pval($coord, "question");
if ($question) {
$dragonletter .= "*";
$owlletter = "";
$dragoncolor = "blue" unless $dragoncolor;
}
my $score = pval($coord, "move_value");
if ($score) {
# FIXME: Should round this, not truncate it.
# Also, should remove trailing "." if not necessary.
$dragonletter = substr($score, 0,3);
$dragoncolor = "blue";
$owlletter="";
$alt = "whack";
}
my $colorboard_imgsrc = createPngFile($bw, $img_pix_size, "",
$dragonletter, $dragoncolor,
$owlletter, $owlcolor, $markcolor);
$colorboard .= qq@ <TD><A
href="$name?tstfile=$tstfile&num=$num&move=$coord"
target=movewin>@ .
qq@<IMG border=0 HEIGHT=$img_pix_size WIDTH=$img_pix_size
@ .
address@hidden"html/images/$colorboard_imgsrc"></A></TD>\n@;
}
$colorboard .= " <TD align=center valign=center> $j </TD>\n
</TR>\n";
}
$colorboard .= colorboard_letter_row($boardsize);
$colorboard .= "\n</TABLE>\n";
print $colorboard;
print qq@</TD><TD valign=top>@;
# table on the right, with information
print qq@<TABLE border=1>\n@;
print qq@
<TR><TD>number:</TD><TD>$attribs{"num"}</TD>
</TR><TR><TD>status:</TD><TD>$attribs{"status"}</TD>
</TR><TR><TD>correct:</TD><TD>$attribs{"correct"}</TD>
</TR><TR><TD>answer:</TD><TD>$attribs{"answer"}</TD>
</TR><TR><TD>gtp:</TD><TD>$attribs{"gtp_command"}</TD>
</TR><TR><TD>category:</TD><TD>$attribs{"category"}</TD>
</TR><TR><TD>severity:</TD><TD>$attribs{"severity"}</TD>
</TR><TR><TD>description:</TD><TD>$attribs{"description"}</TD>
</tr><tr><td> </td><td> </td>
</TR><TR><TD>cputime:</TD><TD>$attribs{"cputime"}</TD>
</TR><TR><TD>$counters[0]:</TD><TD>$attribs{"$counters[0]_counter"}</TD>
</TR><TR><TD>$counters[1]:</TD><TD>$attribs{"$counters[1]_counter"}</TD>
</TR><TR><TD>$counters[2]:</TD><TD>$attribs{"$counters[2]_counter"}</TD>
</TR><TR><TD>$counters[3]:</TD><TD>$attribs{"$counters[3]_counter"}</TD>
</TR>
</TABLE>\n\n@;
print qq@</TD></TR>
</TABLE>@;
my $gtpall = $attribs{gtp_all};
$gtpall =~ s/<BR>//mg;
$gtpall =~ s/\s+$//mg;
$gtpall =~ address@hidden ((?:\w|[-+.\\/])+) [ \t]* (\d*) @x
or $gtpall =~m/(.*?)/; #Problems!!!!
my $cmdline = "gq -l $1 " . ($2 ? "-L $2 " : "");
if ($gtpall =~ m@ .* (owl_attack|owl_defend|dragon_status) \s* ([A-Z]\d{1,2})
\s* $ @x) {
$cmdline .= "--decide-dragon $2 -o x.sgf" ;
} elsif ($gtpall =~ m@ .* (gg_genmove\s+[whiteblack]*) \s* address@hidden) {
$cmdline .= "-t -w -d0x101800";
} elsif ($gtpall =~ m@ .* (attack|defend) \s* ([A-Z]\d{1,2}) \s* $ @x) {
$cmdline .= "--decide-string $2 -o x.sgf";
} else {
$cmdline .= " <BR> (directive unrecognized)";
}
# again hr
# print qq@<HR>\n\n@;
# Cmd-line-Table at bottom
print qq@<TABLE><TR><TD>\n@;
print qq@<TABLE border=1>\n@;
print qq@ <TR><TD>CMD Line Hint:</TD><TD>$cmdline</TD></TR>\n@;
print qq@ <TR><TD>Full GTP:</TD><TD>$attribs{gtp_all}</TD></TR>\n</TABLE>\n@;
print qq@</TD><TD>\n@;
# explanation at the right
print qq@<PRE>
<FONT color=green>green=alive</FONT>
<FONT color=cyan>cyan=dead</FONT>
<FONT color=red>red=critical</FONT>
<FONT color=yellow>yellow=unknown</FONT>
<FONT color=magenta>magenta=unchecked</FONT>
</PRE>@;
print qq@</TD></TR></TABLE>\n\n@;
# again hr
print qq@<HR>\n\n@;
# sgf/trace file
print qq@
<TABLE border=0>
<TR><TD><A href="$name?tstfile=$tstfile&num=$num&sgf=1">SGF File</A>
</TD><TD> <A href="$name?tstfile=$tstfile&num=$num&trace=1"
target=tracefile>Trace File</A>
</TD></TR></TABLE>
@;
print address@hidden | owl_status\n@;
print "\n\n</HTML>";
# print %attribs;
} else {
if ($small) {
summaryDiagrams();
}
#CASE 3 - test file summary.