gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] readconnect patch


From: Paul Pogonyshev
Subject: [gnugo-devel] readconnect patch
Date: Wed, 17 Mar 2004 23:43:46 +0200
User-agent: KMail/1.6.50

This patch makes recursive_disconnect2() look for attacks on one
of the strings on each recursion, not only check if the string is
already captured.  This seems pretty logical to me---if a capture
is a valid disconnection, why not look for it?

If there is an unconditional attack, the function claims win right
away.  If there is a ko attack, it is added as a move candidate.

Regression breakage:

connection:38   FAIL 0 [1 E1]
connection:56   PASS 1 D8 [1 D8]
connection:69   PASS 1 M3 [1 M2|M3]
connection:87   PASS 1 S10 [1 S10]
connection:103  PASS 1 K2 [1 K2]
connection:110  PASS 0 [0]
trevora:530     PASS H4 [H4]
strategy2:73    FAIL E7 [F7|R17|P15]
nngs:900        FAIL S14 [Q15]
strategy4:206   PASS L8 [L8]
nngs3:1170      FAIL B7 [B1]
nando:4         PASS 1 S10 [1 S10|T9]

8 PASSes, 4 FAILs.  I haven't verified them though.

There seem to be an increase in reading nodes (current figures
are a bit different from those in BREAKAGE because of paul_5_5.6):

  Total nodes: 1528880848 2747570 10716532

Paul



--- readconnect.c.~1.70.~       2004-02-12 23:29:11.000000000 +0200
+++ readconnect.c       2004-03-10 23:31:46.000000000 +0200
@@ -2135,6 +2135,12 @@ recursive_disconnect2(int str1, int str2
   int savemove = NO_MOVE;
   int savecode = 0;
   int tried_moves = 0;
+  int attack_code1;
+  int attack_pos1;
+  int attack_code2;
+  int attack_pos2;
+  SGFTree *save_sgf_dumptree = sgf_dumptree;
+  int save_count_variations = count_variations;
 #if USE_HASHTABLE_NG
   int  value;
 #else
@@ -2169,7 +2175,31 @@ recursive_disconnect2(int str1, int str2
     SGFTRACE2(PASS_MOVE, WIN, "connection depth limit reached");
     return WIN;
   }
-  
+
+  sgf_dumptree = NULL;
+  count_variations = 0;
+
+  attack_code1 = attack(str1, &attack_pos1);
+  if (attack_code1 == WIN) {
+    SGFTRACE2(attack_pos1, WIN, "one string is capturable");
+    if (move)
+      *move = attack_pos1;
+
+    return WIN;
+  }
+
+  attack_code2 = attack(str2, &attack_pos2);
+  if (attack_code2 == WIN) {
+    SGFTRACE2(attack_pos2, WIN, "one string is capturable");
+    if (move)
+      *move = attack_pos2;
+
+    return WIN;
+  }
+
+  sgf_dumptree = save_sgf_dumptree;
+  count_variations = save_count_variations;
+
 #if USE_HASHTABLE_NG
   if ((stackp <= depth) && (hashflags & HASH_DISCONNECT)
       && tt_get(&ttable, komaster, kom_pos, DISCONNECT, str1, str2,
@@ -2227,7 +2257,26 @@ recursive_disconnect2(int str1, int str2
 
   num_moves = find_string_connection_moves(str1, str2, other,
                                           moves, &distance);
-  
+  if (attack_code1 != 0 && num_moves < MAX_MOVES) {
+    for (k = 0; k < num_moves; k++) {
+      if (moves[k] == attack_pos1)
+       break;
+    }
+
+    if (k == num_moves)
+      moves[num_moves++] = attack_pos1;
+  }
+
+  if (attack_code2 != 0 && num_moves < MAX_MOVES) {
+    for (k = 0; k < num_moves; k++) {
+      if (moves[k] == attack_pos2)
+       break;
+    }
+
+    if (k == num_moves)
+      moves[num_moves++] = attack_pos2;
+  }
+
   for (k = 0; k < num_moves; k++) {
     int new_komaster;
     int new_kom_pos;




reply via email to

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