gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Patch: removal of DEFEND_BOTH_MOVE


From: Inge Wallin
Subject: [gnugo-devel] Patch: removal of DEFEND_BOTH_MOVE
Date: Sat, 26 Jan 2002 20:38:14 +0100 (MET)

Here is a patch that completes the introduction of ALL_MOVE, namely
the removal of the, now obsolete, DEFEND_BOTH_MOVE.

The next step is to generate code that uses ALL_MOVE for more than
defense of strings.

        -Inge

diff -ur gnugo/engine/liberty.h gnugo-iw/engine/liberty.h
--- gnugo/engine/liberty.h      Wed Jan 23 15:06:16 2002
+++ gnugo-iw/engine/liberty.h   Sat Jan 26 19:40:21 2002
@@ -331,7 +331,6 @@
 void add_my_atari_atari_move(int pos, int size);
 void add_your_atari_atari_move(int pos, int size);
 void add_vital_eye_move(int pos, int eyespace, int color);
-void add_defend_both_move(int pos, int str1, int str2);
 void add_block_territory_move(int pos);
 void add_expand_territory_move(int pos);
 void add_expand_moyo_move(int pos);
diff -ur gnugo/engine/move_reasons.c gnugo-iw/engine/move_reasons.c
--- gnugo/engine/move_reasons.c Tue Jan 22 16:02:49 2002
+++ gnugo-iw/engine/move_reasons.c      Sat Jan 26 19:42:20 2002
@@ -357,8 +357,6 @@
   case OWL_DEFEND_MOVE_GOOD_KO:
   case OWL_DEFEND_MOVE_BAD_KO:
     return dragons[what];
-  case DEFEND_BOTH_MOVE:
-    return worms[worm_pair1[what]];
   case EITHER_MOVE:
     /* FIXME: What should we return here? */
     return worms[either_data[what].what1];
@@ -1020,23 +1018,6 @@
 
 
 /*
- * Add to the reasons for the move at (pos) that it defends
- * both (str1) and (str2) (e.g. from a double atari). This move
- * reason is only used for defense of own stones.
- */
-void
-add_defend_both_move(int pos, int str1, int str2)
-{
-  int worm1 = find_worm(worm[str1].origin);
-  int worm2 = find_worm(worm[str2].origin);
-  int worm_pair = find_worm_pair(worm1, worm2);
-
-  ASSERT_ON_BOARD1(str1);
-  ASSERT_ON_BOARD1(str2);
-  add_move_reason(pos, DEFEND_BOTH_MOVE, worm_pair);
-}
-
-/*
  * Add to the reasons for the move at (pos) that it secures
  * territory by blocking.
  */
@@ -1586,14 +1567,6 @@
                    pos, black_eye[aa].dragon, aa);
          break;
          
-       case DEFEND_BOTH_MOVE:
-         worm1 = worm_pair1[move_reasons[r].what];
-         worm2 = worm_pair2[move_reasons[r].what];
-         aa = worms[worm1];
-         bb = worms[worm2];
-         gprintf("Move at %1m defends both %1m and %1m\n", pos, aa, bb);
-         break;
-               
        case EITHER_MOVE:
        case ALL_MOVE:
          /* FIXME: Generalize this. */
diff -ur gnugo/engine/move_reasons.h gnugo-iw/engine/move_reasons.h
--- gnugo/engine/move_reasons.h Tue Jan 22 16:02:49 2002
+++ gnugo-iw/engine/move_reasons.h      Sat Jan 26 19:39:46 2002
@@ -61,8 +61,6 @@
 #define YOUR_ATARI_ATARI_MOVE   52
 #define VITAL_EYE_MOVE          54
 
-#define DEFEND_BOTH_MOVE        62
-
 #define ANTISUJI_MOVE           70
 
 #define EITHER_MOVE             100
diff -ur gnugo/engine/value_moves.c gnugo-iw/engine/value_moves.c
--- gnugo/engine/value_moves.c  Fri Jan 25 17:38:02 2002
+++ gnugo-iw/engine/value_moves.c       Sat Jan 26 19:44:21 2002
@@ -89,8 +89,7 @@
            || move_reasons[r].type == DEFEND_MOVE_GOOD_KO
            || move_reasons[r].type == DEFEND_MOVE_BAD_KO
            || move_reasons[r].type == CONNECT_MOVE
-           || move_reasons[r].type == CUT_MOVE
-           || move_reasons[r].type == DEFEND_BOTH_MOVE)
+           || move_reasons[r].type == CUT_MOVE)
          break;
        /* FIXME: Add code for EITHER_MOVE and ALL_MOVE here. */
       }
@@ -571,7 +570,6 @@
           */
          break;
        case SEMEAI_MOVE:
-       case DEFEND_BOTH_MOVE:    /* Maybe need better check for this case. */
        case OWL_DEFEND_MOVE:
        case OWL_DEFEND_MOVE_GOOD_KO:
        case OWL_DEFEND_MOVE_BAD_KO:
@@ -1736,35 +1734,6 @@
 
        TRACE("  %1m: %f - both defends %1m (%f) and defends %1m (%f)\n",
              pos, this_value, aa, aa_value, bb, bb_value);
-
-       tot_value += this_value;
-       break;
-       
-      case DEFEND_BOTH_MOVE:
-       /* This is complete nonsense, but still better than nothing.
-        * FIXME: Do this in a reasonable way.
-        */
-       worm1 = worm_pair1[move_reasons[r].what];
-       worm2 = worm_pair2[move_reasons[r].what];
-       aa = worms[worm1];
-       bb = worms[worm2];
-
-       /* If both worms are dead, this move reason has no value. */
-       if (dragon[aa].matcher_status == DEAD 
-           && dragon[bb].matcher_status == DEAD)
-         break;
-
-       /* Also if there is a combination attack, we assume it covers
-         * the same thing.
-        */
-       if (move_reason_known(pos, YOUR_ATARI_ATARI_MOVE, -1))
-         break;
-
-       this_value = 2 * gg_min(worm[aa].effective_size, 
-                               worm[bb].effective_size);
-
-       TRACE("  %1m: %f - defends both %1m and %1m\n",
-             pos, this_value, aa, bb);
 
        tot_value += this_value;
        break;



reply via email to

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