gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] atari_atari patch


From: Gunnar Farneback
Subject: [gnugo-devel] atari_atari patch
Date: Tue, 22 Jan 2002 22:10:37 +0100
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 includes a minor improvement of the atari_atari code.

- atari_atari_find_defense_moves() revised

/Gunnar

Index: engine/combination.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/combination.c,v
retrieving revision 1.20
diff -u -r1.20 combination.c
--- engine/combination.c        16 Jan 2002 22:19:03 -0000      1.20
+++ engine/combination.c        22 Jan 2002 13:51:19 -0000
@@ -1005,7 +1005,7 @@
   int neighbors;
   int adjs[MAXCHAIN];
   int mx[BOARDMAX];
-  int r;
+  int r, s;
 
   memset(mx, 0, sizeof(mx));
 
@@ -1054,6 +1054,27 @@
        if (num_moves == AA_MAX_MOVES)
          return num_moves;
        mx[attack_point] = 1;
+      }
+
+      /* If the neighbor has at most three liberties, try all of them
+       * for defense, except self-ataris.
+       */
+      liberties = findlib(adjs[k], 3, libs);
+      if (liberties <= 3) {
+       for (s = 0; s < liberties; s++) {
+         if (!mx[libs[s]]
+             && !is_self_atari(libs[s], board[str])
+             && trymove(libs[s], board[str], "aa_defend-B", str,
+                        EMPTY, NO_MOVE)) {
+           if (attack(str, NULL) == 0) {
+             moves[num_moves++] = libs[s];
+             mx[libs[s]] = 1;
+           }
+           popgo();
+           if (num_moves == AA_MAX_MOVES)
+             return num_moves;
+         }
+       }
       }
     }
     



reply via email to

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