gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] endgame patch


From: Gunnar Farnebäck
Subject: [gnugo-devel] endgame patch
Date: Sat, 19 Mar 2005 22:09:59 +0100
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI)

This patch revises endgame_find_backfilling_dame() to solve filllib:47
with negligible effect on node counts (about 0.01%).

- increase search depth after filling liberties in
  endgame_find_backfilling_dame()
- try harder to find a safe backfilling move in
  endgame_find_backfilling_dame()

/Gunnar

Index: engine/endgame.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/endgame.c,v
retrieving revision 1.10
diff -u -r1.10 endgame.c
--- engine/endgame.c    13 Nov 2004 04:46:43 -0000      1.10
+++ engine/endgame.c    19 Mar 2005 00:14:18 -0000
@@ -399,6 +399,8 @@
   int false_eye_libs[MAXLIBS];
   int dpos;
   int loop_again = 1;
+  int potential_moves[BOARDMAX];
+  int num_potential_moves = 0;
   int move = NO_MOVE;
 
   while (loop_again) {
@@ -411,29 +413,38 @@
       if (!safe_move(inessential_libs[k], other)
          || !trymove(inessential_libs[k], other, "endgame", str))
        continue;
+      increase_depth_values();
       if (board[str] == EMPTY)
        break;
       if (attack_and_defend(str, NULL, NULL, NULL, &dpos)) {
-       if (worm[dpos].color == EMPTY) 
-         move = dpos;
+       if (worm[dpos].color == EMPTY) {
+         potential_moves[num_potential_moves] = dpos;
+         num_potential_moves++;
+       }
        forced_backfilling_moves[dpos] = 1;
-       trymove(dpos, color, "endgame", str);
+       if (trymove(dpos, color, "endgame", str))
+         increase_depth_values();
        loop_again = 1;
        break;
       }
     }
   }
   
-  while (stackp > 0)
+  while (stackp > 0) {
     popgo();
+    decrease_depth_values();
+  }
 
-  if (move != NO_MOVE && safe_move(move, color)) {
-    TRACE("  backfilling dame found at %1m for string %1m\n", move, str);
-    if (color == color_to_move) {
-      add_expand_territory_move(move);
-      set_minimum_territorial_value(move, 0.1);
+  for (k = num_potential_moves - 1; k >= 0; k--)
+    if (safe_move(potential_moves[k], color)) {
+      move = potential_moves[k];
+      TRACE("  backfilling dame found at %1m for string %1m\n", move, str);
+      if (color == color_to_move) {
+       add_expand_territory_move(move);
+       set_minimum_territorial_value(move, 0.1);
+      }
+      break;
     }
-  }    
 }
 
 /* Find liberties of the string str with various characteristics. See




reply via email to

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