gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Another bug report


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Another bug report
Date: Tue, 01 Jan 2002 18:45:41 +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)

I wrote:
> Confirmed. This particular problem can only occur when the
> --capture-all-dead option is used, which we haven't tested very much.
> The appended patch for GNU Go 3.0.0 fixes it. GNU Go 3.1.18 doesn't
> have this problem but that turned out to be due to a (different) bug.
> :-)

This patch fixes both bugs for 3.1.18 and adds assertions in
do_genmove().

/Gunnar

Index: engine/aftermath.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/aftermath.c,v
retrieving revision 1.17
diff -u -r1.17 aftermath.c
--- engine/aftermath.c  15 Dec 2001 14:35:26 -0000      1.17
+++ engine/aftermath.c  1 Jan 2002 17:41:26 -0000
@@ -669,19 +669,19 @@
    * The solution is to look for tactically attackable opponent stones
    * that still remain on the board but should be removed.
    */
-  for (m = 0; m < board_size; m++)
-    for (n = 0; n < board_size; n++)
-      pos = POS(m, n);
-      if (board[pos] == other
-         && (worm[pos].unconditional_status == UNKNOWN
-             || do_capture_dead_stones)
-         && (DRAGON2(pos).safety == DEAD
-             || DRAGON2(pos).safety == TACTICALLY_DEAD)
-         && worm[pos].attack_codes[0] != 0) {
-       *aftermath_move = worm[pos].attack_points[0];
-       return 1;
-      }
-      
+  for (pos = BOARDMIN; pos < BOARDMAX; pos++) {
+    if (board[pos] == other
+       && (worm[pos].unconditional_status == UNKNOWN
+           || do_capture_dead_stones)
+       && (DRAGON2(pos).safety == DEAD
+           || DRAGON2(pos).safety == TACTICALLY_DEAD)
+       && worm[pos].attack_codes[0] != 0
+       && !is_illegal_ko_capture(worm[pos].attack_points[0], color)) {
+      *aftermath_move = worm[pos].attack_points[0];
+      return 1;
+    }
+  }
+  
   /* No move found. */
   return -1;
 }
Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.21
diff -u -r1.21 genmove.c
--- engine/genmove.c    15 Dec 2001 14:35:26 -0000      1.21
+++ engine/genmove.c    1 Jan 2002 17:41:29 -0000
@@ -446,6 +446,7 @@
       && !doing_scoring
       && (play_out_aftermath || capture_all_dead)
       && aftermath_genmove(move, color, NULL, 0) > 0) {
+    ASSERT1(is_legal(*move, color), *move);
     val = 1.0;
     TRACE("Aftermath move at %1m\n", *move);
     move_considered(*move, val);
@@ -459,6 +460,7 @@
       && !doing_scoring
       && capture_all_dead
       && aftermath_genmove(move, color, NULL, 1) > 0) {
+    ASSERT1(is_legal(*move, color), *move);
     val = 1.0;
     TRACE("Aftermath move at %1m\n", *move);
     move_considered(*move, val);



reply via email to

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