[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, 26 Apr 2002 20:42:33 +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 adds some aftermath traces and a new debug option
DEBUG_TOP_MOVES which allows the top moves traces to be printed
without running the full -t option.
/Gunnar
Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.26
diff -u -r1.26 aftermath.c
--- engine/aftermath.c 11 Apr 2002 19:52:05 -0000 1.26
+++ engine/aftermath.c 26 Apr 2002 17:45:03 -0000
@@ -999,6 +999,17 @@
}
}
}
+
+ if (debug & DEBUG_AFTERMATH) {
+ gprintf("White captured: %d\n", a->white_captured);
+ gprintf("Black captured: %d\n", a->black_captured);
+ gprintf("White prisoners: %d\n", a->white_prisoners);
+ gprintf("Black prisoners: %d\n", a->black_prisoners);
+ gprintf("White territory: %d\n", a->white_territory);
+ gprintf("Black territory: %d\n", a->black_territory);
+ gprintf("White area: %d\n", a->white_area);
+ gprintf("Black area: %d\n", a->black_area);
+ }
}
float
Index: engine/gnugo.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/gnugo.h,v
retrieving revision 1.53
diff -u -r1.53 gnugo.h
--- engine/gnugo.h 24 Apr 2002 11:54:36 -0000 1.53
+++ engine/gnugo.h 26 Apr 2002 18:37:11 -0000
@@ -220,6 +220,8 @@
#define DEBUG_READING_CACHE 0x080000
#define DEBUG_TERRITORY 0x100000
#define DEBUG_OWL_PERSISTENT_CACHE 0x200000
+#define DEBUG_TOP_MOVES 0x400000
+
/* hash flag bits
*
* Regarding HASH_DEFAULT:
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.27
diff -u -r1.27 value_moves.c
--- engine/value_moves.c 11 Apr 2002 19:52:05 -0000 1.27
+++ engine/value_moves.c 26 Apr 2002 18:37:19 -0000
@@ -2439,36 +2439,33 @@
print_top_moves(void)
{
int k;
- int m, n;
int pos;
float tval;
for (k = 0; k < 10; k++)
best_move_values[k] = 0.0;
-
- for (m = 0; m < board_size; m++)
- for (n = 0; n < board_size; n++) {
- pos = POS(m, n);
- if (move[pos].final_value <= 0.0)
- continue;
+ for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
+ if (!ON_BOARD(pos) || move[pos].final_value <= 0.0)
+ continue;
- tval = move[pos].final_value;
+ tval = move[pos].final_value;
- for (k = 9; k >= 0; k--)
- if (tval > best_move_values[k]) {
- if (k < 9) {
- best_move_values[k+1] = best_move_values[k];
- best_moves[k+1] = best_moves[k];
- }
- best_move_values[k] = tval;
- best_moves[k] = pos;
+ for (k = 9; k >= 0; k--)
+ if (tval > best_move_values[k]) {
+ if (k < 9) {
+ best_move_values[k+1] = best_move_values[k];
+ best_moves[k+1] = best_moves[k];
}
- }
-
- TRACE("\nTop moves:\n");
- for (k = 0; k < 10 && best_move_values[k] > 0.0; k++) {
- TRACE("%d. %1M %f\n", k+1, best_moves[k], best_move_values[k]);
+ best_move_values[k] = tval;
+ best_moves[k] = pos;
+ }
+ }
+
+ if (verbose > 0 || (debug & DEBUG_TOP_MOVES)) {
+ gprintf("\nTop moves:\n");
+ for (k = 0; k < 10 && best_move_values[k] > 0.0; k++)
+ gprintf("%d. %1M %f\n", k+1, best_moves[k], best_move_values[k]);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] trace patch,
Gunnar Farneback <=