[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] trace patch
From: |
Gunnar Farneback |
Subject: |
[gnugo-devel] trace patch |
Date: |
Fri, 17 May 2002 21:20:07 +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) |
This patch makes some small improvements of trace and debug output
plus adds a few test cases.
- only print debug output for eyes created during owl reading if owl
debug is also enabled
- better traces for unused owl patterns
- --decide-connection also reports ko results
- bugfix in load_and_score_sgf_file()
- new test cases
/Gunnar
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.86
diff -u -r1.86 owl.c
--- engine/owl.c 6 May 2002 14:21:34 -0000 1.86
+++ engine/owl.c 17 May 2002 13:43:15 -0000
@@ -1225,8 +1225,9 @@
sgf_dumptree = save_sgf_dumptree;
count_variations = save_count_variations;
- DEBUG(DEBUG_EYES, "owl: true_genus=%d matches_found=%d\n",
- true_genus, matches_found);
+ if ((debug & DEBUG_EYES) && (debug & DEBUG_OWL))
+ gprintf("owl: true_genus=%d matches_found=%d\n",
+ true_genus, matches_found);
true_genus -= matches_found;
if (true_genus >= 2
@@ -1843,8 +1844,9 @@
matchpat(owl_shapes_callback, other,
&owl_vital_apat_db, shape_moves, owl->goal);
- DEBUG(DEBUG_EYES, "owl: true_genus=%d matches_found=%d\n",
- true_genus, matches_found);
+ if ((debug & DEBUG_EYES) && (debug & DEBUG_OWL))
+ gprintf("owl: true_genus=%d matches_found=%d\n",
+ true_genus, matches_found);
true_genus -= matches_found;
sgf_dumptree = save_sgf_dumptree;
@@ -2227,11 +2229,16 @@
int lunch;
int eye_color;
int topological_intersections;
+ int save_debug = debug;
memset(mw, 0, sizeof(mw));
memset(mx, 0, sizeof(mx));
memset(vital_values, 0, sizeof(vital_values));
UNUSED(komaster);
+ /* Turn off eye debugging if we're not also debugging owl. */
+ if (!(debug & DEBUG_OWL))
+ debug &= ~DEBUG_EYES;
+
for (k = 0; k < MAX_MOVES; k++) {
moves[k].pos = 0;
moves[k].value = -1;
@@ -2409,8 +2416,10 @@
*/
#if 0
/* Found two certain eyes---look no further. */
- if (true_genus >= 2)
+ if (true_genus >= 2) {
+ debug = save_debug;
return 2;
+ }
#endif
if (max != min) {
@@ -2549,6 +2558,8 @@
}
}
}
+
+ debug = save_debug;
return true_genus;
}
@@ -2751,16 +2762,29 @@
list->pattern_list, list);
if (allpats && verbose) {
int i;
- TRACE("Remaining valid (but unused) patterns at stack: ");
- dump_stack();
+ int found_one = 0;
+ SGFTree *save_sgf_dumptree = sgf_dumptree;
+ int save_count_variations = count_variations;
+ sgf_dumptree = NULL;
+ count_variations = 0;
+
for (i = list->used ; i < list->counter; i++)
if (check_pattern_hard(list->pattern_list[i].move, color,
list->pattern_list[i].pattern,
- list->pattern_list[i].ll))
+ list->pattern_list[i].ll)) {
+ if (!found_one) {
+ TRACE("Remaining valid (but unused) patterns at stack: ");
+ dump_stack();
+ found_one = 1;
+ }
TRACE("Pattern %s found at %1m with value %d\n",
list->pattern_list[i].pattern->name,
list->pattern_list[i].move,
(int) list->pattern_list[i].pattern->value);
+ }
+
+ sgf_dumptree = save_sgf_dumptree;
+ count_variations = save_count_variations;
}
free(list->pattern_list);
}
Index: engine/sgfdecide.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/sgfdecide.c,v
retrieving revision 1.31
diff -u -r1.31 sgfdecide.c
--- engine/sgfdecide.c 11 May 2002 00:10:08 -0000 1.31
+++ engine/sgfdecide.c 17 May 2002 13:43:15 -0000
@@ -154,6 +154,12 @@
gprintf("%1m and %1m can be connected at %1m (%d variations)\n",
apos, bpos, move, count_variations);
}
+ else if (result == KO_A)
+ gprintf("%1m and %1m can be connected with ko (good) at %1m (%d
variations)\n",
+ apos, bpos, move, count_variations);
+ else if (result == KO_B)
+ gprintf("%1m and %1m can be connected with ko (bad) at %1m (%d
variations)\n",
+ apos, bpos, move, count_variations);
else
gprintf("%1m and %1m cannot be connected (%d variations)\n",
apos, bpos, count_variations);
@@ -168,6 +174,12 @@
gprintf("%1m and %1m can be disconnected at %1m (%d variations)\n",
apos, bpos, move, count_variations);
}
+ else if (result == KO_A)
+ gprintf("%1m and %1m can be disconnected with ko (good) at %1m (%d
variations)\n",
+ apos, bpos, move, count_variations);
+ else if (result == KO_B)
+ gprintf("%1m and %1m can be disconnected with ko (bad) at %1m (%d
variations)\n",
+ apos, bpos, move, count_variations);
else
gprintf("%1m and %1m cannot be disconnected (%d variations)\n",
apos, bpos, count_variations);
Index: interface/play_solo.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_solo.c,v
retrieving revision 1.13
diff -u -r1.13 play_solo.c
--- interface/play_solo.c 18 Apr 2002 19:10:37 -0000 1.13
+++ interface/play_solo.c 17 May 2002 13:43:16 -0000
@@ -272,7 +272,7 @@
if (!strcmp(scoringmode, "aftermath")) {
- if (gameinfo->outfile)
+ if (gameinfo->outfilename)
writesgf(score_tree.root, gameinfo->outfilename);
return;
}
Index: regression/connection.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/connection.tst,v
retrieving revision 1.26
diff -u -r1.26 connection.tst
--- regression/connection.tst 6 May 2002 23:38:36 -0000 1.26
+++ regression/connection.tst 17 May 2002 13:43:17 -0000
@@ -1,6 +1,7 @@
# Reset applicable counters
reset_reading_node_counter
+# See also test 87.
loadsgf games/connection1.sgf
1 same_dragon G17 K17
#? [0]*
@@ -69,6 +70,7 @@
18 same_dragon N17 P17
#? [1]*
+# FIXME: Strange test. Wrong move number?
loadsgf games/dublin1.sgf 71
19 same_dragon B15 E16
#? [0]*
@@ -258,6 +260,23 @@
loadsgf games/handtalk/handtalk13.sgf 116
82 same_dragon M7 M10
#? [0]*
+
+loadsgf games/handtalk/handtalk23.sgf 80
+83 same_dragon K3 L5
+#? [0]*
+84 same_dragon H6 L5
+#? [0]*
+
+loadsgf games/handtalk/handtalk23.sgf 82
+85 same_dragon K3 G3
+#? [0]*
+86 same_dragon K3 M3
+#? [0]*
+
+# See also test 2. Possibly some more move works.
+loadsgf games/connection1.sgf
+87 disconnect R12 R9
+#? [1 S10]*
# Report number of nodes visited by the tactical reading
10000 get_reading_node_counter
Index: regression/handtalk.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/handtalk.tst,v
retrieving revision 1.2
diff -u -r1.2 handtalk.tst
--- regression/handtalk.tst 6 May 2002 23:38:36 -0000 1.2
+++ regression/handtalk.tst 17 May 2002 13:43:17 -0000
@@ -83,6 +83,10 @@
17 gg_genmove white
#? [B4|B6]*
+loadsgf games/handtalk/handtalk23.sgf 186
+18 gg_genmove white
+#? [S5]*
+
############ End of Tests #################
# Report number of nodes visited by the tactical reading
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] trace patch,
Gunnar Farneback <=