gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] engine/influence.c


From: Arend Bayer
Subject: Re: [gnugo-devel] engine/influence.c
Date: Tue, 24 Sep 2002 19:30:53 +0200 (CEST)

For the record, I have merged unrolling_3_9.1a + the patch below (the
previous patch forgot to make the same changes to the ununrolled
version of the code).

Arend


Index: engine/influence.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/influence.c,v
retrieving revision 1.62
diff -u -r1.62 influence.c
--- engine/influence.c  24 Sep 2002 16:57:35 -0000      1.62
+++ engine/influence.c  24 Sep 2002 17:30:37 -0000
@@ -129,13 +129,8 @@
          int a = (arg_di)*(i-m) + (arg_dj)*(j-n); \
          contribution *= (a*a) * b; /* contribution *= cos(phi) */ \
        } \
-       if (contribution <= INFLUENCE_CUTOFF) { \
-          if (permeability < 1.0 || q->w[arg_i][arg_j] != 0.0) \
-           continue; \
-          else { \
-            contribution = 1.01 * INFLUENCE_CUTOFF; \
-         } \
-       } \
+       if (contribution <= INFLUENCE_CUTOFF) \
+         continue; \
        if (q->w[arg_i][arg_j] == 0.0) { \
          q->queuei[queue_end] = (arg_i); \
          q->queuej[queue_end] = (arg_j); \
@@ -241,7 +236,7 @@
         */
        if (d > 3) { /* diagonal movement */
          permeability *= gg_max(permeability_array[i+di][j],
-                                        permeability_array[i][j+dj]);
+                                permeability_array[i][j+dj]);
          inv_damping = inv_diagonal_damping;
          dfactor = 0.5;
        }
@@ -253,7 +248,7 @@
        if (permeability == 0.0)
          continue;

-       contribution = permeability * current_strength * inv_diagonal_damping;
+       contribution = permeability * current_strength * inv_damping;

        /* Finally direction dependent damping. */
        if (i != m || j != n) {
@@ -263,14 +258,8 @@
        }

        /* Stop spreading influence if the contribution becomes too low. */
-       if (contribution <= INFLUENCE_CUTOFF) {
-          if (permeability_array[i][j] < 1.0
-             || (d > 3 && diagonal_permeability < 1.0)
-             || q->w[i+di][j+dj] != 0.0)
-           continue;
-          else
-            contribution = 1.01 * INFLUENCE_CUTOFF;
-       }
+       if (contribution <= INFLUENCE_CUTOFF)
+         continue;

        /* If no influence here before, add the point to the queue for
         * further spreading.
@@ -1096,8 +1085,7 @@
        accumulate_influence(q, i, j, BLACK);
     }

-  if (q->is_territorial_influence)
-    value_territory(q, m, n, color);
+  value_territory(q, m, n, color);
   segment_influence(q);

   if (((q == &initial_influence || q == &initial_opposite_influence)
@@ -1123,13 +1111,14 @@
 {
   float bi = q->black_influence[m][n];
   float wi = q->white_influence[m][n];
+  float terr = q->territory_value[m][n];

   ASSERT_ON_BOARD2(m, n);

-  if (bi > 0.0 && wi == 0.0)
+  if (bi > 0.0 && wi == 0.0 && terr < -0.95)
     return BLACK;

-  if (wi > 0.0 && bi == 0.0)
+  if (wi > 0.0 && bi == 0.0 && terr > 0.95)
     return WHITE;

   return EMPTY;
@@ -1184,9 +1173,9 @@
   /* default */
   if (territory_color != EMPTY)
     color = territory_color;
-  else if ((bi > 10.0 * wi && bi > 10.0 && wi < 10.0) || bi > 25.0 * wi)
+  else if (bi > 10.0 * wi && bi > 10.0 && wi < 10.0)
     color = BLACK;
-  else if ((wi > 10.0 * bi && wi > 10.0 && bi < 10.0) || wi > 25.0 * bi)
+  else if (wi > 10.0 * bi && wi > 10.0 && bi < 10.0)
     color = WHITE;
   else
     color = EMPTY;





reply via email to

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