[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] atari_atari patch
From: |
Gunnar Farneback |
Subject: |
Re: [gnugo-devel] atari_atari patch |
Date: |
Fri, 21 Dec 2001 17:19:22 +0100 |
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) |
Inge wrote:
> The size of the constraint diagram doesn't match the size of the
> pattern itself.
Argh, enough of this. The appended patch implements a check in mkpat
that the main diagram and the constraint diagram have the same size.
More detailed consistency checking is left on the TODO list. The patch
also repairs a few more broken patterns (all harmless though).
- mkpat checks that main diagram and constraint diagram have the same size
/Gunnar
Index: TODO
===================================================================
RCS file: /cvsroot/gnugo/gnugo/TODO,v
retrieving revision 1.6
diff -u -r1.6 TODO
--- TODO 18 Dec 2001 18:31:21 -0000 1.6
+++ TODO 21 Dec 2001 15:30:12 -0000
@@ -46,8 +46,8 @@
order of perceived difficulty.
1. Add a check in patterns/mkpat.c that the main diagram and the
- constraint diagram are consistent. A partial implementation would
- only make sure that they have the same size.
+ constraint diagram are consistent. Currently it is only verified
+ that they have the same size.
2. Complete the conversion to 1-dimensional representation.
Check all comments before functions to make them agree with
Index: patterns/aa_attackpats.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/aa_attackpats.db,v
retrieving revision 1.2
diff -u -r1.2 aa_attackpats.db
--- patterns/aa_attackpats.db 20 Dec 2001 21:09:43 -0000 1.2
+++ patterns/aa_attackpats.db 21 Dec 2001 15:30:12 -0000
@@ -180,7 +180,8 @@
:8,c
*.X
-oXO
+?.X
+?XO
;olib(*)>3
Index: patterns/conn.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/conn.db,v
retrieving revision 1.10
diff -u -r1.10 conn.db
--- patterns/conn.db 28 Nov 2001 21:22:54 -0000 1.10
+++ patterns/conn.db 21 Dec 2001 15:30:12 -0000
@@ -1157,7 +1157,7 @@
?gd
?bc
Xaf
-?e
+?e.
;xcut(a)
Index: patterns/endgame.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/endgame.db,v
retrieving revision 1.17
diff -u -r1.17 endgame.db
--- patterns/endgame.db 21 Dec 2001 07:36:42 -0000 1.17
+++ patterns/endgame.db 21 Dec 2001 15:30:12 -0000
@@ -529,10 +529,11 @@
Pattern EE405
+# gf Made main diagram consistent with constraint diagram. (3.1.18)
-|XO endgame move
-|.* one point gote
-+--
+|XO? endgame move
+|.*. one point gote
++---
:8,bOX,terri(1)
Index: patterns/fuseki.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/fuseki.db,v
retrieving revision 1.3
diff -u -r1.3 fuseki.db
--- patterns/fuseki.db 15 Dec 2001 08:13:35 -0000 1.3
+++ patterns/fuseki.db 21 Dec 2001 15:30:12 -0000
@@ -914,6 +914,7 @@
Pattern F410b
+# gf Made constraint diagram consistent with main diagram. (3.1.18)
x........?? extend
x...O....xx
@@ -924,12 +925,12 @@
:8,FjEd,shape(2)
-x........?
-a...O....?
-b......*.?
-x.........
-x.........
-----------
+x........??
+a...O....xx
+b......*..?
+x.........?
+x.........?
+-----------
; x_somewhere(a,b)
Index: patterns/mkpat.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/mkpat.c,v
retrieving revision 1.36
diff -u -r1.36 mkpat.c
--- patterns/mkpat.c 20 Dec 2001 19:43:20 -0000 1.36
+++ patterns/mkpat.c 21 Dec 2001 15:30:12 -0000
@@ -351,9 +351,9 @@
/* When this is called, elements go from (mini,minj) inclusive to
* (maxi-1, maxj-1) [ie exclusive]. Make them inclusive.
- * ie maximum element lies on (maxi,maxj)
+ * Ie maximum element lies on (maxi,maxj).
*/
-
+
--maxi;
--maxj;
@@ -666,12 +666,35 @@
}
}
+ /* Now j holds the width of this constraint diagram line. Require
+ * this to match the main diagram width stored in maxj. However,
+ * maxj was modified by find_extents() so we have to compensate for
+ * this.
+ */
+ if (j != maxj + 1) {
+ fprintf(stderr, "%s(%d) : error : Mismatching width of constraint line in
pattern %s\n",
+ current_file, current_line_number, pattern_names[patno]);
+ fatal_errors++;
+ return;
+ }
+
current_i++;
return;
}
-
+/* Check that the constraint diagram had the same number of rows as
+ * the main diagram.
+ */
+static void
+check_constraint_diagram_size(void)
+{
+ if (current_i != maxi + 1) {
+ fprintf(stderr, "%s(%d) : error : Mismatching height of constraint diagram
in pattern %s\n",
+ current_file, current_line_number, pattern_names[patno]);
+ fatal_errors++;
+ }
+}
/* On reading a line starting ':', finish up and write
* out the current pattern
@@ -1518,7 +1541,7 @@
* 5 Reading constraint diagram.
* 6 Waiting for constraint line (";" line).
* 7 Reading a constraint
- * 7 Reading an action
+ * 8 Reading an action
*
* FIXME: This state machine should be possible to simplify.
*
@@ -1584,8 +1607,11 @@
}
else if (line[0] == '\n' || line[0] == '#') {
/* nothing */
- if (state == 2 || state == 5)
+ if (state == 2 || state == 5) {
+ if (state == 5)
+ check_constraint_diagram_size();
state++;
+ }
}
else if (strchr(VALID_PATTERN_CHARS, line[0])
|| strchr(VALID_EDGE_CHARS, line[0])
@@ -1628,6 +1654,9 @@
}
}
else if (line[0] == ';') {
+ if (state == 5)
+ check_constraint_diagram_size();
+
if (state == 5 || state == 6 || state == 7) {
read_constraint_line(line+1);
state = 7;
@@ -1639,6 +1668,8 @@
}
else if (line[0] == '>') {
if (state == 4 || state == 5 || state == 6 || state == 7 || state == 8) {
+ if (state == 5)
+ check_constraint_diagram_size();
read_action_line(line+1);
state = 8;
}
Index: patterns/patterns.db
===================================================================
RCS file: /cvsroot/gnugo/gnugo/patterns/patterns.db,v
retrieving revision 1.38
diff -u -r1.38 patterns.db
--- patterns/patterns.db 21 Dec 2001 07:36:42 -0000 1.38
+++ patterns/patterns.db 21 Dec 2001 15:30:13 -0000
@@ -11972,7 +11972,7 @@
XX....
AAXX..
-..O*.
+..O*..
......
------
@@ -12990,7 +12990,7 @@
:8,OX,value(7)
-xX
+xXx
...
.*.
O..