[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] trevor_1_13.7
From: |
Trevor Morris |
Subject: |
[gnugo-devel] trevor_1_13.7 |
Date: |
Fri, 02 Nov 2001 14:03:11 -0500 |
http://www.public32.com/games/go/trevor_1_13.7
- 1D documentation revisions.
- twogtp-a now give a (halfhearted) default to missing goprog.
- twogtp-a works for VC builds now.
- mkpat.c generates more useful errors.
- mkpat.c forces output to have compile error if input also had errors.
This patch is independent of trevor_1_13.6
Index: engine/optics.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/optics.c,v
retrieving revision 1.23
diff -u -r1.23 optics.c
--- engine/optics.c 2001/10/26 07:21:11 1.23
+++ engine/optics.c 2001/11/02 18:54:24
@@ -1348,12 +1348,12 @@
return 0;
}
-/* recognize_eye(i, j, *ai, *aj, *di, *dj, *max, *min, eye, heye,
- * add_moves, color), where (i,j) is the origin of an eyespace,
+/* recognize_eye(pos, *attack_point, *defense_point, *max, *min, eye_data,
+ * half_eye_data, add_moves, color), where pos is the origin of an eyespace,
* returns 1 if there is a pattern in eyes.c matching the eyespace, or
- * 0 if no match is found. If there is a key point for attack, (*ai,
- * *aj) are set to its location, or (-1, -1) if there is none.
- * Similarly (*di, *dj) is the location of a vital defense point. *min
+ * 0 if no match is found. If there is a key point for attack,
(*attack_point)
+ * is set to its location, or (-1, -1) if there is none.
+ * Similarly (*defense_point) is the location of a vital defense point. *min
* and *max are the minimum and maximum number of eyes that can be
* made in this eyespace respectively. Vital attack/defense points
* exist if and only if *min != *max.
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.24
diff -u -r1.24 owl.c
--- engine/owl.c 2001/10/26 07:21:11 1.24
+++ engine/owl.c 2001/11/02 18:54:41
@@ -2739,10 +2739,10 @@
}
-/* Use the owl code to determine whether the dragon at (m, n) is owl
- * safe after an own move at (ti, tj). This is used to detect
+/* Use the owl code to determine whether the dragon at (move) is owl
+ * safe after an own move at (target). This is used to detect
* blunders. In case the dragon is not safe, it also tries to find a
- * defense point making (ti, tj) safe in a later move.
+ * defense point making (target) safe in a later move.
*
* Should be called only when stackp==0.
*/
Index: interface/gtp_examples/twogtp-a
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/gtp_examples/twogtp-a,v
retrieving revision 1.4
diff -u -r1.4 twogtp-a
--- interface/gtp_examples/twogtp-a 2001/09/26 00:35:03 1.4
+++ interface/gtp_examples/twogtp-a 2001/11/02 18:54:44
@@ -1,4 +1,4 @@
-#! /usr/bin/perl -w
+#! /usr/bin/perl -w
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# This program is distributed with GNU GO, a Go program. #
@@ -55,6 +55,8 @@
use Getopt::Long;
use FileHandle;
use strict;
+use warnings;
+use Carp;
#following added globally to allow "use strict" :
my $vertex;
@@ -111,6 +113,15 @@
"games=i" => \$games
);
+if (!$white) {
+ $white = '../gnugo.exe --mode gtp --quiet';
+ warn "Defaulting white to: $white";
+}
+if (!$black) {
+ $black = '../gnugo.exe --mode gtp --quiet';
+ warn "Defaulting black to: $black";
+}
+
die $helpstring unless defined $white and defined $black;
# create FileHandles
@@ -277,6 +288,7 @@
my $line = "";
while ($line eq "") {
chop($line = <$h>) or die "No response!";
+ $line =~ s/(\s|\n)*$//smg;
}
}
@@ -285,14 +297,12 @@
# ignore empty lines
my $line = "";
while ($line eq "") {
- chop($line = <$h>) or die "No response!";
-# $line =~ s/\s*$//m; #chop doesn't work nicely w/ WINDOWS CR-LF combo.
-# print "L:$line:L\n";
+ defined($line = <$h>) or die "No response!";
+ $line =~ s/(\s|\n)*$//smg;
}
-# print "LINE: $line\n";
- $line =~ s/\s*$//;
my ($equals, $move) = split(' ', $line, 2);
$line = <$h>;
+ defined($move) or confess "no move found: line was: '$line'";
return $move;
}
@@ -328,6 +338,7 @@
}
sub standard_to_sgf {
+ for (@_) { confess "Yikes!" if !defined($_); }
for (@_) { tr/A-Z/a-z/ };
$_ = shift(@_);
/([a-z])([0-9]+)/;
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.24
diff -u -r1.24 mkpat.c
--- patterns/mkpat.c 2001/11/01 23:38:30 1.24
+++ patterns/mkpat.c 2001/11/02 18:54:51
@@ -635,7 +635,9 @@
return;
notrectangle:
- fprintf(stderr, "Warning pattern %s not rectangular\n",
pattern_names[patno]);
+ fprintf(stderr, "%s(%d) : error : Pattern %s not rectangular\n",
+ current_file, current_line_number, pattern_names[patno]);
+ fatal_errors++;
return;
}
@@ -1085,8 +1087,9 @@
label = (int) *p;
if (label_coords[label][0] == -1) {
fprintf(stderr,
- "mkpat: The constraint or action uses a label (%c) that
wasn't
specified in the diagram (pattern %s).\n",
- label, pattern_names[patno]);
+ "%s(%d) : error : The constraint or action uses a label
(%c) that
wasn't specified in the diagram (pattern %s).\n",
+ current_file, current_line_number, label,
pattern_names[patno]);
+ fatal_errors++;
return;
}
}
@@ -1268,7 +1271,11 @@
for (node = 0;node < el; node++) {
assert(elements[node].x >= mini && elements[node].y >= minj);
- assert(elements[node].x <= maxi && elements[node].y <= maxj);
+ if (!(elements[node].x <= maxi && elements[node].y <= maxj)) {
+ fprintf(stderr, "%s(%d) : error : Maximum number of elements
exceeded in %s.\n",
+ current_file, current_line_number, name);
+ fatal_errors++;
+ };
fprintf(outfile, " {%d,%d,%d}%s",
elements[node].x - ci, elements[node].y - cj, elements[node].att,
@@ -1546,8 +1553,8 @@
break;
case 2:
case 3:
- fprintf(stderr, "Warning, no entry line for pattern %s\n",
- pattern_names[patno]);
+ fprintf(stderr, "%s(%d) : warning : No entry line for pattern %s\n",
+ current_file, current_line_number, pattern_names[patno]);
break;
case 5:
case 6:
@@ -1585,8 +1592,9 @@
case 6:
case 7:
case 8:
- fprintf(stderr, "Huh, another diagram here? (pattern %s)\n",
- pattern_names[patno]);
+ fprintf(stderr, "%s(%d) : error : Huh, another diagram here? (pattern
%s)\n",
+ current_file, current_line_number, pattern_names[patno]);
+ fatal_errors++;
break;
case 1:
state++; /* fall through */
@@ -1611,8 +1619,8 @@
state = 4;
}
else {
- fprintf(stderr, "Warning, unexpected entry line in pattern %s\n",
- pattern_names[patno]);
+ fprintf(stderr, "%s(%d) : warning : Unexpected entry line in pattern
%s\n",
+ current_file, current_line_number, pattern_names[patno]);
}
}
else if (line[0] == ';') {
@@ -1635,9 +1643,15 @@
pattern_names[patno]);
}
}
- else
- fprintf(stderr, "Warning, malformed line \"%s\" in pattern %s\n",
- line, pattern_names[patno]);
+ else {
+ int i = strlen(line);
+ char c = line[i-1];
+ line[i-1] = 0; /*Chop of \n*/
+ fprintf(stderr, "%s(%d) : error : Malformed line \"%s\" in pattern
%s\n",
+ current_file, current_line_number, line, pattern_names[patno]);
+ line[i-1]=c; /*Put it back - maybe not necessary at this point.*/
+ fatal_errors++;
+ }
}
if (patno >= 0) {
@@ -1698,6 +1712,10 @@
write_pattern_db(output_FILE, argv[gg_optind]);
+
+ if (fatal_errors) {
+ fprintf(output_FILE, "\n#error: One or more fatal errors compiling
%s\n", current_file);
+ }
return fatal_errors ? 1 : 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] trevor_1_13.7,
Trevor Morris <=