gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] arend_3_17.1 crashes


From: Gunnar Farneback
Subject: Re: [gnugo-devel] arend_3_17.1 crashes
Date: Wed, 26 Feb 2003 22:58:35 +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)

Arend wrote:
> I didn't fix this because I don't like to put an "sgf_message = NULL"
> at the top of the function. This doesn't stop a bug if sgf_message
> indeed doesn't get initialized.

It has occured to me that the sgf messages have gradually become less
useful while we have been restructuring the reading code. The appended
patch fixes this by keeping track of which move generator has first
proposed each move.

- better sgf messages in reading.c

/Gunnar

Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.107
diff -u -r1.107 reading.c
--- engine/reading.c    23 Feb 2003 18:52:39 -0000      1.107
+++ engine/reading.c    26 Feb 2003 21:21:51 -0000
@@ -48,7 +48,11 @@
 /* Size of array where candidate moves are stored. */
 #define MAX_MOVES 50
 
-#define ADD_CANDIDATE_MOVE(move, this_score, moves)\
+/* Please notice that message had better be a fixed string. Only the
+ * pointer to it is saved and there is no attempt to free up any
+ * storage.
+ */
+#define ADD_CANDIDATE_MOVE(move, this_score, moves, this_message)\
   do {\
     int u;\
     for (u = 0; u < (moves).num; u++)\
@@ -59,6 +63,7 @@
     if ((u == (moves).num) && ((moves).num < MAX_MOVES)) {\
       (moves).pos[(moves).num] = move;\
       (moves).score[(moves).num] = this_score;\
+      (moves).message[(moves).num] = this_message;\
       ((moves).num)++;\
     }\
   } while (0)
@@ -71,6 +76,7 @@
         for (v = u; v < (moves).num-1; v++) {\
          (moves).pos[v] = (moves).pos[v+1];\
          (moves).score[v] = (moves).score[v+1];\
+         (moves).message[v] = (moves).message[v+1];\
        }\
         ((moves).num)--;\
        break;\
@@ -122,6 +128,7 @@
 {
   int pos[MAX_MOVES];
   int score[MAX_MOVES];
+  const char *message[MAX_MOVES];
   int num;
 };
 
@@ -1157,6 +1164,7 @@
    */
   moves.pos[0] = lib;
   moves.score[0] = 0;
+  moves.message[0] = "liberty";
   moves.num = 1;
   
   break_chain_moves(str, &moves);
@@ -1170,7 +1178,7 @@
     int ko_move;
 
     xpos = moves.pos[k];
-    if (komaster_trymove(xpos, color, "defend1-A", str, komaster, kom_pos,
+    if (komaster_trymove(xpos, color, moves.message[k], str, komaster, kom_pos,
                         &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
@@ -1270,6 +1278,7 @@
   for (k = 0; k < liberties; k++) {
     moves.pos[k] = libs[k];
     moves.score[k] = 0;
+    moves.message[k] = "liberty";
   }
   moves.num = liberties;
   
@@ -1295,7 +1304,7 @@
 
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend2-A", str,
+    if (komaster_trymove(xpos, color, moves.message[k], str,
                         komaster, kom_pos, &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
@@ -1332,7 +1341,7 @@
         */
        if (!is_self_atari(xpos, color)
            || has_neighbor(xpos, color))
-         ADD_CANDIDATE_MOVE(xpos, 0, moves);
+         ADD_CANDIDATE_MOVE(xpos, 0, moves, "backfill-A");
 
       }
     }
@@ -1341,7 +1350,7 @@
       for (r = 0; r < liberties2; r++) {
        xpos = libs2[r];
        if (!is_self_atari(xpos, color))
-         ADD_CANDIDATE_MOVE(xpos, 0, moves);
+         ADD_CANDIDATE_MOVE(xpos, 0, moves, "backfill-B");
       }
     }
   }
@@ -1355,12 +1364,11 @@
     int ko_move;
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend2-B", str,
+    if (komaster_trymove(xpos, color, moves.message[k], str,
                         komaster, kom_pos, &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
-       int acode = do_attack(str, &suggest_move, new_komaster,
-           new_kom_pos);
+       int acode = do_attack(str, &suggest_move, new_komaster, new_kom_pos);
        popgo();
        CHECK_RESULT(savecode, savemove, acode, xpos, move,
                     "defense effective - B");
@@ -1397,7 +1405,7 @@
        continue;
       /* If the newly placed would be in atari, we won't even try. */
       if (approxlib(apos, color, 2, NULL) > 1)
-       ADD_CANDIDATE_MOVE(apos, 0, moves);
+       ADD_CANDIDATE_MOVE(apos, 0, moves, "superstring-liberty");
     }
     
     /* Now we are truly desperate. Try playing second order liberties of
@@ -1432,12 +1440,11 @@
     int ko_move;
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend2-E", str,
+    if (komaster_trymove(xpos, color, moves.message[k], str,
                         komaster, kom_pos, &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
-       int acode = do_attack(str, &suggest_move, new_komaster,
-           new_kom_pos);
+       int acode = do_attack(str, &suggest_move, new_komaster, new_kom_pos);
        popgo();
        CHECK_RESULT(savecode, savemove, acode, xpos, move,
                     "defense effective - A");
@@ -1504,6 +1511,7 @@
   for (k = 0; k < liberties; k++) {
     moves.pos[k] = libs[k];
     moves.score[k] = 0;
+    moves.message[k] = "liberty";
   }
   moves.num = liberties;
   
@@ -1527,12 +1535,11 @@
     
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend3-A", str, komaster, kom_pos,
+    if (komaster_trymove(xpos, color, moves.message[k], str, komaster, kom_pos,
                         &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
-       int acode = do_attack(str, &suggest_move, new_komaster,
-           new_kom_pos);
+       int acode = do_attack(str, &suggest_move, new_komaster, new_kom_pos);
        popgo();
        CHECK_RESULT(savecode, savemove, acode, xpos, move,
                     "defense effective - A");
@@ -1642,19 +1649,17 @@
     int ko_move;
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend3-E", str,
+    if (komaster_trymove(xpos, color, moves.message[k], str,
                         komaster, kom_pos, &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
-       int acode = do_attack(str, &suggest_move, new_komaster,
-           new_kom_pos);
+       int acode = do_attack(str, &suggest_move, new_komaster, new_kom_pos);
        popgo();
        CHECK_RESULT(savecode, savemove, acode, xpos, move,
                     "defense effective - A");
       }
       else {
-       if (do_attack(str, &suggest_move, new_komaster,
-             new_kom_pos) != WIN) {
+       if (do_attack(str, &suggest_move, new_komaster, new_kom_pos) != WIN) {
          savemove = xpos;
          savecode = KO_B;
        }
@@ -1680,7 +1685,7 @@
        continue;
       /* If the newly placed would be in atari, we won't even try. */
       if (approxlib(apos, color, 2, NULL) > 1)
-       ADD_CANDIDATE_MOVE(apos, 0, moves);
+       ADD_CANDIDATE_MOVE(apos, 0, moves, "superstring-liberty");
     }
 
     /* Now we are truly desperate. Try playing second order liberties of
@@ -1708,19 +1713,17 @@
     int ko_move;
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend3-E", str,
+    if (komaster_trymove(xpos, color, moves.message[k], str,
                         komaster, kom_pos, &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
-       int acode = do_attack(str, &suggest_move, new_komaster,
-           new_kom_pos);
+       int acode = do_attack(str, &suggest_move, new_komaster, new_kom_pos);
        popgo();
        CHECK_RESULT(savecode, savemove, acode, xpos, move,
                     "defense effective - A");
       }
       else {
-       if (do_attack(str, &suggest_move, new_komaster,
-             new_kom_pos) != WIN) {
+       if (do_attack(str, &suggest_move, new_komaster, new_kom_pos) != WIN) {
          savemove = xpos;
          savecode = KO_B;
        }
@@ -1778,6 +1781,7 @@
   for (k = 0; k < liberties; k++) {
     moves.pos[k] = libs[k];
     moves.score[k] = 0;
+    moves.message[k] = "liberty";
   }
   moves.num = liberties;
   
@@ -1803,19 +1807,17 @@
     
     xpos = moves.pos[k];
     
-    if (komaster_trymove(xpos, color, "defend4-A", str, komaster, kom_pos,
+    if (komaster_trymove(xpos, color, moves.message[k], str, komaster, kom_pos,
                         &new_komaster, &new_kom_pos,
                         &ko_move, stackp <= ko_depth && savecode == 0)) {
       if (!ko_move) {
-       int acode = do_attack(str, &suggest_move, new_komaster,
-           new_kom_pos);
+       int acode = do_attack(str, &suggest_move, new_komaster, new_kom_pos);
        popgo();
        CHECK_RESULT(savecode, savemove, acode, xpos, move,
                     "defense effective - A");
       }
       else {
-       if (do_attack(str, &suggest_move, new_komaster,
-             new_kom_pos) != WIN) {
+       if (do_attack(str, &suggest_move, new_komaster, new_kom_pos) != WIN) {
          savemove = xpos;
          savecode = KO_B;
        }
@@ -1871,7 +1873,7 @@
       if (is_self_atari(lib + d, color))
        continue;
       
-      ADD_CANDIDATE_MOVE(lib + d, 0, *moves);
+      ADD_CANDIDATE_MOVE(lib + d, 0, *moves, "special_rescue");
     }
   }
 }
@@ -1917,7 +1919,7 @@
        
        for (s = 0; s < liberties && s < 4; s++) {
          if (!is_self_atari(newlibs[s], color))
-           ADD_CANDIDATE_MOVE(newlibs[s], 0, *moves);
+           ADD_CANDIDATE_MOVE(newlibs[s], 0, *moves, "special_rescue2");
        }
        break_chain_moves(newstr, moves);
        break_chain2_efficient_moves(newstr, moves);
@@ -1995,7 +1997,7 @@
          continue;
        
        /* Try to play at (fpos). */
-       ADD_CANDIDATE_MOVE(fpos, 0, *moves);
+       ADD_CANDIDATE_MOVE(fpos, 0, *moves, "special_rescue3");
       }
     }
   }
@@ -2065,7 +2067,7 @@
          dump_stack();
          showboard(0);
        }
-       ADD_CANDIDATE_MOVE(cpos, 0, *moves);
+       ADD_CANDIDATE_MOVE(cpos, 0, *moves, "hane_rescue");
       }
     }
   }
@@ -2123,7 +2125,7 @@
       for (s = 0; s < liberties2; s++)
        if (!liberty_of_string(libs2[s], str)
            && !is_self_atari(libs2[s], color))
-         ADD_CANDIDATE_MOVE(libs2[s], 0, *moves);
+         ADD_CANDIDATE_MOVE(libs2[s], 0, *moves, "special_rescue5-A");
 
       /* Reinforce the second order chain. */
       if (liberties2 <= liberties) {
@@ -2137,7 +2139,7 @@
          
          findlib(adjs[t], 1, &cpos);
          if (!is_self_atari(cpos, color))
-           ADD_CANDIDATE_MOVE(cpos, 0, *moves);
+           ADD_CANDIDATE_MOVE(cpos, 0, *moves, "special_rescue5-B");
        }
   
        /* Defend against double atari in the surrounding chain early. */
@@ -2217,9 +2219,9 @@
        
        
        if (!is_self_atari(cpos + right, color))
-         ADD_CANDIDATE_MOVE(cpos + right, 0, *moves);
+         ADD_CANDIDATE_MOVE(cpos + right, 0, *moves, "special_rescue6-A");
        if (!is_self_atari(cpos + up, color))
-         ADD_CANDIDATE_MOVE(cpos + up, 0, *moves);
+         ADD_CANDIDATE_MOVE(cpos + up, 0, *moves, "special_rescue6-B");
       }
     }
   }
@@ -2266,7 +2268,7 @@
       && countstones(str) == 1
       && approxlib(lib, other, 2, libs2) == 1
       && !is_self_atari(libs2[0], color))
-    ADD_CANDIDATE_MOVE(libs2[0], 0, *moves);
+    ADD_CANDIDATE_MOVE(libs2[0], 0, *moves, "set_up_snapback");
 }
 
 
@@ -2367,7 +2369,7 @@
        /* (dpos) looks like a good move. Add it to the list with a
          * substantial initial score.
         */
-       ADD_CANDIDATE_MOVE(dpos, 10, *moves);
+       ADD_CANDIDATE_MOVE(dpos, 10, *moves, "edge_clamp");
       }
     }
   }
@@ -2463,14 +2465,15 @@
           * move.
           */
          if (countlib(apos + up - right) == 1)
-           ADD_CANDIDATE_MOVE(apos + up, 10, *moves);
+           ADD_CANDIDATE_MOVE(apos + up, 10, *moves, "propose_edge-A");
          else {
-           ADD_CANDIDATE_MOVE(apos + up, 0, *moves);
+           ADD_CANDIDATE_MOVE(apos + up, 0, *moves, "propose_edge-B");
            
            /* Add c if empty */
            if (board[apos + right + up] == EMPTY
                && (liberties != 2 || color != to_move))
-             ADD_CANDIDATE_MOVE(apos + right + up, 0, *moves);
+             ADD_CANDIDATE_MOVE(apos + right + up, 0, *moves,
+                                "propose_edge-C");
          }
        }
       }
@@ -3205,7 +3208,7 @@
           break_chain_moves(adjs[r], &moves);
 
         findlib(adjs[r], 1, &hpos);
-        ADD_CANDIDATE_MOVE(hpos, 0, moves);
+        ADD_CANDIDATE_MOVE(hpos, 0, moves, "save_boundary");
       }
 
       /* Get the two liberties of (str). */
@@ -3234,12 +3237,12 @@
                && board[NORTH(apos)] != other
                && board[EAST(apos)] != other)
            || !is_self_atari(apos, other))
-          ADD_CANDIDATE_MOVE(apos, 0, moves);
+          ADD_CANDIDATE_MOVE(apos, 0, moves, "liberty");
 
         /* Try backfilling if atari is impossible. */
         if (stackp <= backfill_depth
            && approxlib(apos, other, 2, libs2) == 1) {
-          ADD_CANDIDATE_MOVE(libs2[0], 0, moves);
+          ADD_CANDIDATE_MOVE(libs2[0], 0, moves, "backfill");
           /* If there is a neighbor in atari, we also try back-capturing. */
           for (r = 0; r < 4; r++) {
            int bpos = libs2[0] + delta[r];
@@ -3249,7 +3252,7 @@
                * enough. We might also want to check against snapback.
               */
              findlib(adjs[0], 1, &xpos);
-             ADD_CANDIDATE_MOVE(xpos, 0, moves);
+             ADD_CANDIDATE_MOVE(xpos, 0, moves, "back-capture");
            }
           }
         }
@@ -3298,7 +3301,7 @@
         int ko_move;
 
         int apos = moves.pos[k];
-        if (komaster_trymove(apos, other, "attack2-A", str,
+        if (komaster_trymove(apos, other, moves.message[k], str,
                             komaster, kom_pos, &new_komaster, &new_kom_pos,
                             &ko_move, stackp <= ko_depth && savecode == 0)) {
           if (!ko_move) {
@@ -3452,7 +3455,7 @@
         break_chain_moves(adjs[r], &moves);
     
         findlib(adjs[r], 1, &hpos);
-        ADD_CANDIDATE_MOVE(hpos, 0, moves);
+        ADD_CANDIDATE_MOVE(hpos, 0, moves, "save_boundary");
       }
   
       /* Defend against double atari in the surrounding chain early. */
@@ -3479,7 +3482,7 @@
                && board[NORTH(apos)] != other
                && board[EAST(apos)] != other)
            || !is_self_atari(apos, other))
-          ADD_CANDIDATE_MOVE(apos, 0, moves);
+          ADD_CANDIDATE_MOVE(apos, 0, moves, "liberty");
 
         edge_closing_backfill_moves(str, apos, &moves);
 
@@ -3487,7 +3490,7 @@
         /* Try backfilling if atari is impossible. */
         if (stackp <= backfill_depth
            && approxlib(apos, other, 2, libs2) == 1) {
-          ADD_CANDIDATE_MOVE(libs2[0], 0, moves);
+          ADD_CANDIDATE_MOVE(libs2[0], 0, moves, "backfill");
         }
 #endif
     
@@ -3523,7 +3526,7 @@
           break_chain_moves(adjs[r], &moves);
           break_chain2_moves(adjs[r], &moves, 1);
           for (k = 0; k < 2; k++)
-           ADD_CANDIDATE_MOVE(libs2[k], 0, moves);
+           ADD_CANDIDATE_MOVE(libs2[k], 0, moves, "save_boundary-2");
         }
       }
     }
@@ -3541,7 +3544,7 @@
         if (stackp >= branch_depth && k > 0)
           break;
         xpos = moves.pos[k];
-        if (komaster_trymove(xpos, other, "attack3-A", str,
+        if (komaster_trymove(xpos, other, moves.message[k], str,
                             komaster, kom_pos, &new_komaster,
                             &new_kom_pos, &ko_move,
                             stackp <= ko_depth && savecode == 0)) {
@@ -3674,7 +3677,7 @@
         break_chain_moves(adjs[r], &moves);
 
         findlib(adjs[r], 1, &hpos);
-        ADD_CANDIDATE_MOVE(hpos, 0, moves);
+        ADD_CANDIDATE_MOVE(hpos, 0, moves, "save_boundary");
       }
 
 
@@ -3703,7 +3706,7 @@
                && board[NORTH(apos)] != other
                && board[EAST(apos)] != other)
             || !is_self_atari(apos, other))
-          ADD_CANDIDATE_MOVE(apos, 0, moves);
+          ADD_CANDIDATE_MOVE(apos, 0, moves, "liberty");
 
         edge_closing_backfill_moves(str, apos, &moves);
 
@@ -3824,9 +3827,9 @@
        * free or occupied by something else.
        */
       if (BOARD(bi, aj) == EMPTY)
-        ADD_CANDIDATE_MOVE(POS(bi, aj), 10, *moves);
+        ADD_CANDIDATE_MOVE(POS(bi, aj), 10, *moves, "find_cap");
       else if (BOARD(ai, bj) == EMPTY)
-        ADD_CANDIDATE_MOVE(POS(ai, bj), 10, *moves);
+        ADD_CANDIDATE_MOVE(POS(ai, bj), 10, *moves, "find_cap");
     }
   }
 }
@@ -3864,7 +3867,7 @@
        xpos = newlibs[1];
 
       if (!is_self_atari(xpos, other)) {
-       ADD_CANDIDATE_MOVE(xpos, 0, *moves);
+       ADD_CANDIDATE_MOVE(xpos, 0, *moves, "special_attack2");
       }
     }
   }
@@ -3919,7 +3922,7 @@
       return; /* Incorrect configuration, give up. */
 
     if (!is_self_atari(xpos, other))
-      ADD_CANDIDATE_MOVE(xpos, 0, *moves);
+      ADD_CANDIDATE_MOVE(xpos, 0, *moves, "special_attack3");
   }
 }
 
@@ -4014,7 +4017,7 @@
        if (elibs > dlibs)
          continue;
 
-       ADD_CANDIDATE_MOVE(dpos, 0, *moves);
+       ADD_CANDIDATE_MOVE(dpos, 0, *moves, "special_attack4");
       }
     }
   }
@@ -4054,7 +4057,7 @@
                     && liberty_of_string(NORTH(libs[k]), str))
              || (ON_BOARD1(EAST(libs[k]))
                     && liberty_of_string(EAST(libs[k]), str)))) {
-       ADD_CANDIDATE_MOVE(libs[k], 0, *moves);
+       ADD_CANDIDATE_MOVE(libs[k], 0, *moves, "draw_back");
       }
     }
   }
@@ -4134,7 +4137,7 @@
     if (number_o > number_x)
       return;
 
-    ADD_CANDIDATE_MOVE(apos + right, 0, *moves);
+    ADD_CANDIDATE_MOVE(apos + right, 0, *moves, "edge_closing_backfill");
     return;
   }
 }
@@ -4224,7 +4227,7 @@
          score = -5;
        if (countlib(str) == 2)
          score -= 10;
-       ADD_CANDIDATE_MOVE(epos, score, *moves);
+       ADD_CANDIDATE_MOVE(epos, score, *moves, "edge_block-A");
 
        if (countlib(dpos) == 1)
          score = 25;
@@ -4232,7 +4235,7 @@
          score = 0;
        if (countlib(str) == 2)
          score -= 10;
-       ADD_CANDIDATE_MOVE(fpos, score, *moves);
+       ADD_CANDIDATE_MOVE(fpos, score, *moves, "edge_block-B");
       }
       else if (countlib(cpos) == 2 && countlib(dpos) > 1) {
        int libs[2];
@@ -4243,7 +4246,7 @@
        else
          move = libs[0];
        if (!is_self_atari(move, other))
-         ADD_CANDIDATE_MOVE(move, 0, *moves);
+         ADD_CANDIDATE_MOVE(move, 0, *moves, "edge_block-C");
       }
     }
   }
@@ -4314,7 +4317,7 @@
       
       if (board[epos] == EMPTY && board[fpos] == EMPTY 
          && (board[gpos] != color))
-       ADD_CANDIDATE_MOVE(fpos, 30, *moves);
+       ADD_CANDIDATE_MOVE(fpos, 30, *moves, "edge_block");
     }
   }
 }
@@ -4340,7 +4343,7 @@
   
   for (r = 0; r < adj; r++) {
     findlib(adjs[r], 1, &xpos);
-    ADD_CANDIDATE_MOVE(xpos, 1, *moves);
+    ADD_CANDIDATE_MOVE(xpos, 1, *moves, "break_chain");
   }
 }
 
@@ -4387,7 +4390,7 @@
     break_chain_moves(adjs2[0], moves);
     findlib(adjs2[0], 1, &apos);
     if (!is_self_atari(apos, color))
-      ADD_CANDIDATE_MOVE(apos, 0, *moves);
+      ADD_CANDIDATE_MOVE(apos, 0, *moves, "break_chain2_efficient-A");
     return;
   }
   
@@ -4398,7 +4401,7 @@
   for (k = 0; k < 2; k++)
     if (approxlib(libs[k], other, 3, NULL) <= 2
        && !is_self_atari(libs[1 - k], color))
-      ADD_CANDIDATE_MOVE(libs[1 - k], 0, *moves);
+      ADD_CANDIDATE_MOVE(libs[1 - k], 0, *moves, "break_chain2_efficient-B");
   
   /* A common special case is this kind of edge position
    * 
@@ -4441,10 +4444,10 @@
     return;
 
   if (is_edge_vertex(libs[0]) && !is_self_atari(libs[1], color))
-    ADD_CANDIDATE_MOVE(libs[1], 1, *moves);
+    ADD_CANDIDATE_MOVE(libs[1], 1, *moves, "break_chain2_efficient-C");
 
   if (is_edge_vertex(libs[1]) && !is_self_atari(libs[0], color))
-    ADD_CANDIDATE_MOVE(libs[0], 1, *moves);
+    ADD_CANDIDATE_MOVE(libs[0], 1, *moves, "break_chain2_efficient-C");
 }
 
 /*
@@ -4495,7 +4498,7 @@
          || is_ko(libs[k], color, NULL)
          || (!require_safe
              && approxlib(libs[k], other, 5, NULL) < 5))
-       ADD_CANDIDATE_MOVE(libs[k], 0, *moves);
+       ADD_CANDIDATE_MOVE(libs[k], 0, *moves, "break_chain2-A");
     }
 
     if (stackp <= backfill2_depth || have_common_lib(str, apos, NULL)) {
@@ -4507,7 +4510,7 @@
            int s;
            for (s = 0; s < 2; s++)
              if (!is_self_atari(libs2[s], color))
-               ADD_CANDIDATE_MOVE(libs2[s], 0, *moves);
+               ADD_CANDIDATE_MOVE(libs2[s], 0, *moves, "break_chain2-B");
          }
        }
       }
@@ -4629,7 +4632,7 @@
       /* We use a negative initial score here as we prefer to find
        * direct defense moves.
        */
-      ADD_CANDIDATE_MOVE(xpos, -2, *moves);
+      ADD_CANDIDATE_MOVE(xpos, -2, *moves, "break_chain3");
   }
 }
 
@@ -4653,7 +4656,7 @@
     int liberties = countlib(adjs[k]);
     if (liberties == 1) {
       findlib(adjs[k], 1, &apos);
-      ADD_CANDIDATE_MOVE(apos, 0, *moves);
+      ADD_CANDIDATE_MOVE(apos, 0, *moves, "superstring_breakchain");
     }
     else if (liberties == 2)
       do_find_break_chain2_efficient_moves(str, adjs[k], moves);
@@ -4689,7 +4692,7 @@
          * is safe for the defender.
         */
        if (!is_self_atari(libs[k], board[str]))
-         ADD_CANDIDATE_MOVE(libs[k], 1, *moves);
+         ADD_CANDIDATE_MOVE(libs[k], 1, *moves, "double_atari_chain2");
       }
     }
   }
@@ -4758,6 +4761,7 @@
    */
   moves.pos[0] = lib;
   moves.score[0] = 0;
+  moves.message[0] = "liberty";
   moves.num = 1;
   
   break_chain_moves(str, &moves);
@@ -4779,8 +4783,7 @@
       ko_capture = 0;
 
     if ((komaster != other || !ko_capture)
-       && trymove(xpos, color, "restricted_defend1-A", str,
-                  komaster, kom_pos)) {
+       && trymove(xpos, color, moves.message[k], str, komaster, kom_pos)) {
       int libs = countlib(str);
       if (libs > 2) {
        popgo();
@@ -5554,7 +5557,7 @@
   findlib(str, 2, libs);
 
   for (k = 0; k < 2; k++)
-    ADD_CANDIDATE_MOVE(libs[k], 0, moves);
+    ADD_CANDIDATE_MOVE(libs[k], 0, moves, "simple_ladder_attack");
 
   order_moves(str, &moves, other, read_function_name, 0, NO_MOVE);
 
@@ -5564,7 +5567,7 @@
     int ko_move;
 
     apos = moves.pos[k];
-    if (komaster_trymove(apos, other, "simple_ladder_attack", str,
+    if (komaster_trymove(apos, other, moves.message[k], str,
                         komaster, kom_pos, &new_komaster, &new_kom_pos,
                         &ko_move, savecode == 0)) {
       if (!ko_move) {
@@ -5617,6 +5620,7 @@
 
   moves.pos[0] = lib;
   moves.score[0] = 0;
+  moves.message[0] = "liberty";
   moves.num = 1;
   
   break_chain_moves(str, &moves);
@@ -5628,7 +5632,7 @@
     int ko_move;
 
     xpos = moves.pos[k];
-    if (komaster_trymove(xpos, color, "simple_ladder_defend", str,
+    if (komaster_trymove(xpos, color, moves.message[k], str,
                         komaster, kom_pos,
                         &new_komaster, &new_kom_pos,
                         &ko_move, savecode == 0)) {




reply via email to

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