gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] mixed patch


From: Gunnar Farneback
Subject: [gnugo-devel] mixed patch
Date: Sun, 07 Apr 2002 15:42:03 +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)

- analyze_neighbor() in filllib.c revised
- size of persistent owl cache increased from 100 to 150 entires
- bugfix in owl_confirm_safety()
- territorial value computed also for tactical attacks of dead or
  defenseless stones

The filllib revision is necessary in some of the score2 test cases.

The size of the persistent cache has been increased by 50% since it
has been observed to occasionally be too small.

The bug fixed in owl_confirm_safety() is somewhat serious since
results were put on the persistent owl cache for the wrong function.
In practice this probably didn't matter very much.

Forcing territorial evaluation for tactical attacks of dead or
defenseless stones comes at a small performance penalty but helps to
avoid playing stones inside own territory.

/Gunnar

Index: engine/filllib.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/filllib.c,v
retrieving revision 1.18
diff -u -r1.18 filllib.c
--- engine/filllib.c    4 Mar 2002 06:49:08 -0000       1.18
+++ engine/filllib.c    7 Apr 2002 13:29:27 -0000
@@ -70,7 +70,8 @@
 
     case BLACK:
       if (!worm[pos].inessential && DRAGON2(pos).safety != INESSENTIAL) {
-       if (dragon[pos].matcher_status == ALIVE)
+       if (dragon[pos].matcher_status == ALIVE
+           || dragon[pos].matcher_status == UNKNOWN)
          *found_black = 1;
        else
          *found_white = 1;
@@ -79,7 +80,8 @@
 
     case WHITE:
       if (!worm[pos].inessential && DRAGON2(pos).safety != INESSENTIAL) {
-       if (dragon[pos].matcher_status == ALIVE)
+       if (dragon[pos].matcher_status == ALIVE
+           || dragon[pos].matcher_status == UNKNOWN)
          *found_white = 1;
        else
          *found_black = 1;
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.78
diff -u -r1.78 owl.c
--- engine/owl.c        4 Apr 2002 20:36:26 -0000       1.78
+++ engine/owl.c        7 Apr 2002 13:29:29 -0000
@@ -144,7 +144,7 @@
   int move2;  /* second result coordinate */
 };
 
-#define MAX_OWL_CACHE_SIZE 100
+#define MAX_OWL_CACHE_SIZE 150
 static struct owl_cache persistent_owl_cache[MAX_OWL_CACHE_SIZE];
 static int persistent_owl_cache_size = 0;
 
@@ -3607,8 +3607,8 @@
 }
 
 
-/* Use the owl code to determine whether the dragon at (move) is owl
- * safe after an own move at (target). This is used to detect
+/* Use the owl code to determine whether the dragon at (target) is owl
+ * safe after an own move at (move). This is used to detect
  * blunders. In case the dragon is not safe, it also tries to find a
  * defense point making (target) safe in a later move.
  *
@@ -3640,7 +3640,7 @@
                                  &result, defense_point, NULL, NULL))
     return result;
 
-  if (trymove(move, color, "owl_confirm_safety", target, EMPTY, 0)) {
+  if (trymove(move, color, "owl_confirm_safety", target, EMPTY, NO_MOVE)) {
     /* Check if a compatible owl_attack() is cached. */
     if (search_persistent_owl_cache(OWL_ATTACK, origin, 0, 0,
                                    &result, defense_point, NULL, NULL)) {
@@ -3652,7 +3652,7 @@
     }
     
     init_owl(&owl, target, NO_MOVE, move, 1);
-    if (!do_owl_attack(target, &defense, owl, EMPTY, 0))
+    if (!do_owl_attack(target, &defense, owl, EMPTY, NO_MOVE))
       result = WIN;
     popgo();
   }
@@ -3667,7 +3667,7 @@
        owl->local_owl_node_counter, tactical_nodes,
        gg_cputime() - start);
 
-  store_persistent_owl_cache(OWL_DOES_DEFEND, move, target, 0,
+  store_persistent_owl_cache(OWL_CONFIRM_SAFETY, move, target, 0,
                             result, defense, 0, 0,
                             tactical_nodes, owl->goal, board[target]);
 
Index: engine/value_moves.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/value_moves.c,v
retrieving revision 1.24
diff -u -r1.24 value_moves.c
--- engine/value_moves.c        7 Apr 2002 12:38:44 -0000       1.24
+++ engine/value_moves.c        7 Apr 2002 13:29:30 -0000
@@ -850,7 +850,7 @@
 
 /*
  * Strategical value of connecting (or cutting) the dragon at (dragona)
- * to the dragon at (dragonb). Notice that this function is assymetric.
+ * to the dragon at (dragonb). Notice that this function is asymmetric.
  * This is because connection_value(a, b) is intended to measure the
  * strategical value on the a dragon from a connection to the b dragon.
  * 
@@ -1147,7 +1149,7 @@
     }  
   }
 
-  /* We have to make a gues how much the point where we want to play
+  /* We have to make a guess how much the point where we want to play
    * is dominated by the opponent. The territorial valuation is a
    * good try here.
    */
@@ -1200,6 +1202,7 @@
              "  %1m:   %f (secondary) - attack on %1m (defenseless)\n",
              pos, worm[aa].effective_size, aa);
        secondary_value += worm[aa].effective_size;
+       does_block = 1;
        break;
       }
 
@@ -1213,6 +1216,7 @@
              "  %1m:   %f (secondary) - attack on %1m (dead)\n",
              pos, 0.2 * this_value, aa);
        secondary_value += 0.2 * this_value;
+       does_block = 1;
        break;
       }
 



reply via email to

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