gnugo-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnugo-devel] less DEBUG_INFLUENCE noise


From: Arend Bayer
Subject: [gnugo-devel] less DEBUG_INFLUENCE noise
Date: Wed, 19 Mar 2003 15:55:38 +0100 (CET)


This makes DEBUG_INFLUENCE less noisy by turning it off for influence
computations we are presumably not interested in. More exactly, it
is turned off unless -m8 (for initial influence), --debug-influence <move>
(for move_influence and followup_influence) or DEBUG_ESCAPE (for
escape_influence) is set.

Hope this makes influence debugging less annoying (and a little more
popular) than it is currently.

Arend


Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.76
diff -u -p -r1.76 influence.c
--- engine/influence.c  22 Feb 2003 10:54:24 -0000      1.76
+++ engine/influence.c  19 Mar 2003 14:56:12 -0000
@@ -997,9 +997,22 @@ compute_influence(int color, const char
                  const float strength[BOARDMAX], struct influence_data *q,
                  int move, const char *trace_message)
 {
+  int save_debug = debug;
+
   q->is_territorial_influence = 1;
   q->color_to_move = color;
+
+  /* Turn off DEBUG_INFLUENCE for influence computations we are not
+   * interested in.
+   */
+  if ((move == NO_MOVE
+       && !(printmoyo & PRINTMOYO_INITIAL_INFLUENCE))
+      || (move != debug_influence))
+    debug = debug &~ DEBUG_INFLUENCE;
+
   do_compute_influence(color, safe_stones, strength, q, move, trace_message);
+
+  debug = save_debug;
 }

 /* Return the color of the territory at (pos). If it's territory for
@@ -1445,6 +1458,7 @@ compute_followup_influence(const struct
   char goal[BOARDMAX];
   /* This is the color that will get a followup value. */
   int color = OTHER_COLOR(base->color_to_move);
+  int save_debug = debug;

   memcpy(q, base, sizeof(*q));

@@ -1458,12 +1472,22 @@ compute_followup_influence(const struct
        goal[ii] = 0;
     }

-  q->intrusion_counter = 0;

+  /* Turn off DEBUG_INFLUENCE for influence computations we are not
+   * interested in.
+   */
+  if ((move == NO_MOVE
+       && !(printmoyo & PRINTMOYO_INITIAL_INFLUENCE))
+      || (move != debug_influence))
+    debug = debug &~ DEBUG_INFLUENCE;
+
+  q->intrusion_counter = 0;
   current_influence = q;
   /* Match B patterns for saved stones. */
   matchpat_goal_anchor(followup_influence_callback, color, &barrierspat_db,
                       q, goal, 1);
+
+  debug = save_debug;

   /* Now add the intrusions. */
   add_marked_intrusions(q, color);
@@ -1497,6 +1521,7 @@ compute_escape_influence(int color, cons
 {
   int k;
   int ii;
+  int save_debug = debug;

   /* IMPORTANT: The caching relies on the fact that safe_stones[] and
    * strength[] will currently always be identical for identical board[]
@@ -1539,8 +1564,16 @@ compute_escape_influence(int color, cons
   escape_influence.is_territorial_influence = 0;
   escape_influence.color_to_move = EMPTY;

+  /* Turn off DEBUG_INFLUENCE unless we are specifically interested in
+   * escape computations.
+   */
+  if (!(debug & DEBUG_ESCAPE))
+    debug &= ~DEBUG_INFLUENCE;
+
   do_compute_influence(OTHER_COLOR(color), safe_stones, strength,
                       &escape_influence, -1, NULL);
+
+  debug = save_debug;

   for (ii = BOARDMIN; ii < BOARDMAX; ii++)
     if (ON_BOARD(ii)) {





reply via email to

[Prev in Thread] Current Thread [Next in Thread]