gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] Patch: Removal of ATTACK_EITHER_MOVE


From: Inge Wallin
Subject: [gnugo-devel] Patch: Removal of ATTACK_EITHER_MOVE
Date: Mon, 21 Jan 2002 22:40:32 +0100 (MET)

Here is a patch that removes all handling of ATTACK_EITHER_MOVE.  It
has been replaced by EITHER_MOVE with ATTACK_STRING as a parameter and
is no longer needed.

        -Inge

diff -ur gnugo/engine/liberty.h gnugo-iw/engine/liberty.h
--- gnugo/engine/liberty.h      Mon Jan 21 10:08:29 2002
+++ gnugo-iw/engine/liberty.h   Mon Jan 21 22:15:49 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_attack_either_move(int pos, int str1, int str2);
 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);
diff -ur gnugo/engine/move_reasons.c gnugo-iw/engine/move_reasons.c
--- gnugo/engine/move_reasons.c Mon Jan 21 10:08:29 2002
+++ gnugo-iw/engine/move_reasons.c      Mon Jan 21 22:15:14 2002
@@ -325,7 +325,6 @@
   case OWL_DEFEND_MOVE_GOOD_KO:
   case OWL_DEFEND_MOVE_BAD_KO:
     return dragons[what];
-  case ATTACK_EITHER_MOVE:
   case DEFEND_BOTH_MOVE:
     return worms[worm_pair1[what]];
   case EITHER_MOVE:
@@ -520,19 +519,6 @@
          || move_reason_known(pos, DEFEND_MOVE_BAD_KO, what));
 }
 
-/*
- * Check whether a tactical attack/defense is already known for
- * at least one of two worms in a worm pair.
- */
-static int
-tactical_move_vs_either_worm_known(int pos, int what)
-{
-  return attack_move_reason_known(pos, worm_pair1[what])
-      || attack_move_reason_known(pos, worm_pair2[what])
-      || defense_move_reason_known(pos, worm_pair1[what])
-      || defense_move_reason_known(pos, worm_pair2[what]);
-}
-
 /* Check whether a dragon consists of only one worm. If so, check
  * whether we know of a tactical attack or defense move.
  */
@@ -864,37 +850,6 @@
 }
 
 /*
- * Add to the reasons for the move at (pos) that it attacks
- * either (str1) or (str2) (e.g. a double atari). This move
- * reason is only used for double attacks on opponent stones.
- *
- * Before accepting the move reason, check that the worms are
- * distinct and that neither is undefendable.
- */
-void
-add_attack_either_move(int pos, int str1, int str2)
-{
-  int worm1 = find_worm(worm[str1].origin);
-  int worm2 = find_worm(worm[str2].origin);
-  int worm_pair;
-
-  ASSERT_ON_BOARD1(str1);
-  ASSERT_ON_BOARD1(str2);
-  if (worm1 == worm2)
-    return;
-  
-  if (worm[str1].attack_codes[0] != 0 && worm[str1].defend_codes[0] == 0)
-    return;
-  
-  if (worm[str2].attack_codes[0] != 0 && worm[str2].defend_codes[0] == 0)
-    return;
-  
-  worm_pair = find_worm_pair(worm1, worm2);
-  add_move_reason(pos, ATTACK_EITHER_MOVE, worm_pair);
-}
-
-
-/*
  * Add to the reasons for the move at (pos) that it will accomplish
  * one of two things: either (reason1) on (target1) or (reason2) on 
  * (target2).  
@@ -1530,17 +1485,12 @@
                    pos, black_eye[aa].dragon, aa);
          break;
          
-       case ATTACK_EITHER_MOVE:
        case DEFEND_BOTH_MOVE:
          worm1 = worm_pair1[move_reasons[r].what];
          worm2 = worm_pair2[move_reasons[r].what];
          aa = worms[worm1];
          bb = worms[worm2];
-         
-         if (move_reasons[r].type == ATTACK_EITHER_MOVE)
-           gprintf("Move at %1m attacks either %1m or %1m\n", pos, aa, bb);
-         else
-           gprintf("Move at %1m defends both %1m and %1m\n", pos, aa, bb);
+         gprintf("Move at %1m defends both %1m and %1m\n", pos, aa, bb);
          break;
                
        case EITHER_MOVE:
@@ -1655,9 +1605,6 @@
   { { SEMEAI_MOVE, SEMEAI_THREAT, -1 },
     tactical_move_vs_whole_dragon_known, REDUNDANT,
     "  %1m: 0.0 - (threat to) win semai involving %1m (tactical move as 
well)\n"},
-  { { ATTACK_EITHER_MOVE, DEFEND_BOTH_MOVE, -1 },
-    tactical_move_vs_either_worm_known, REDUNDANT,
-    "  %1m: 0.0 - att. either/def. both involving %1m (direct att./def. as 
well)\n"},
   { { EITHER_MOVE, -1 },
     either_move_redundant, REDUNDANT,
     "  %1m: 0.0 - either move is redundant at %1m (direct att./def. as 
well)\n"},
diff -ur gnugo/engine/move_reasons.h gnugo-iw/engine/move_reasons.h
--- gnugo/engine/move_reasons.h Mon Jan 21 10:08:29 2002
+++ gnugo-iw/engine/move_reasons.h      Mon Jan 21 22:13:00 2002
@@ -61,7 +61,6 @@
 #define YOUR_ATARI_ATARI_MOVE   52
 #define VITAL_EYE_MOVE          54
 
-#define ATTACK_EITHER_MOVE      60
 #define DEFEND_BOTH_MOVE        62
 
 #define ANTISUJI_MOVE           70
diff -ur gnugo/engine/value_moves.c gnugo-iw/engine/value_moves.c
--- gnugo/engine/value_moves.c  Mon Jan 21 10:08:30 2002
+++ gnugo-iw/engine/value_moves.c       Mon Jan 21 22:14:44 2002
@@ -90,7 +90,6 @@
            || move_reasons[r].type == DEFEND_MOVE_BAD_KO
            || move_reasons[r].type == CONNECT_MOVE
            || move_reasons[r].type == CUT_MOVE
-           || move_reasons[r].type == ATTACK_EITHER_MOVE
            || move_reasons[r].type == DEFEND_BOTH_MOVE)
          break;
        /* FIXME: Add code for EITHER_MOVE here. */
@@ -572,7 +571,6 @@
           */
          break;
        case SEMEAI_MOVE:
-       case ATTACK_EITHER_MOVE:
        case DEFEND_BOTH_MOVE:    /* Maybe need better check for this case. */
        case OWL_DEFEND_MOVE:
        case OWL_DEFEND_MOVE_GOOD_KO:
@@ -1720,7 +1718,6 @@
        tot_value += this_value;
        break;
        
-      case ATTACK_EITHER_MOVE:
       case DEFEND_BOTH_MOVE:
        /* This is complete nonsense, but still better than nothing.
         * FIXME: Do this in a reasonable way.
@@ -1738,28 +1735,15 @@
        /* Also if there is a combination attack, we assume it covers
          * the same thing.
         */
-       if (move_reasons[r].type == ATTACK_EITHER_MOVE
-           && move_reason_known(pos, MY_ATARI_ATARI_MOVE, -1))
-         break;
        if (move_reasons[r].type == DEFEND_BOTH_MOVE
            && move_reason_known(pos, YOUR_ATARI_ATARI_MOVE, -1))
          break;
 
-       if (move_reasons[r].type == ATTACK_EITHER_MOVE) {
-         aa_value = adjusted_worm_attack_value(pos, aa);
-         bb_value = adjusted_worm_attack_value(pos, bb);
-         this_value = gg_min(aa_value, bb_value);
-
-         TRACE("  %1m: %f - attacks either %1m (%f) or %1m (%f)\n",
-               pos, this_value, aa, aa_value, bb, bb_value);
-       }
-       else {
-         this_value = 2 * gg_min(worm[aa].effective_size,
-                                 worm[bb].effective_size);
+       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);
-       }
+       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]