gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Weird illegal move bug


From: Gunnar Farnebäck
Subject: Re: [gnugo-devel] Weird illegal move bug
Date: Sat, 11 Jun 2005 23:52:50 +0200
User-agent: EMH/1.14.1 SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.3 Emacs/21.3 (sparc-sun-solaris2.9) MULE/5.0 (SAKAKI)

Evan wrote:
> The SGF below causes GNU Go to produce an illegal move (reg_genmove
> white returns C3, which is occupied).
> 
> The bug is present in current CVS but not in 3.6.  I have not yet
> investigated further.

The blame is on fill_liberty(). The patch below reduces the problem to
a regression failure for the new testcase included in the patch.

- bugfix in find_backfilling_move() in filllib.c

/Gunnar

Index: engine/filllib.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/filllib.c,v
retrieving revision 1.33
diff -u -r1.33 filllib.c
--- engine/filllib.c    24 Dec 2004 20:15:54 -0000      1.33
+++ engine/filllib.c    11 Jun 2005 21:40:29 -0000
@@ -381,6 +381,10 @@
   int saved_move = NO_MOVE;
   int opponent_libs;
   
+  DEBUG(DEBUG_FILLLIB, "find_backfilling_move for %C %1m\n", color, move);
+  if (debug & DEBUG_FILLLIB)
+    dump_stack();
+  
   /* Play (move) and identify all liberties and adjacent strings. */
   if (!trymove(move, color, "find_backfilling_move", move))
     return 0; /* This shouldn't happen, I believe. */
@@ -529,6 +533,9 @@
     success = 1;
   }
 
+  if (!success)
+    *backfill_move = NO_MOVE;
+  
   return success;
 }
 
Index: regression/filllib.tst
===================================================================
RCS file: /cvsroot/gnugo/gnugo/regression/filllib.tst,v
retrieving revision 1.33
diff -u -r1.33 filllib.tst
--- regression/filllib.tst      19 Mar 2005 00:08:28 -0000      1.33
+++ regression/filllib.tst      11 Jun 2005 21:40:29 -0000
@@ -162,3 +162,9 @@
 loadsgf games/filllib15.sgf
 47 reg_genmove black
 #? [L2|K2|J1]
+
+# F1 is an unsafe backfilling move for J1 and must be preceded by e.g. E2.
+loadsgf games/filllib16.sgf
+48 reg_genmove white
+#? [B4|E2|B2]
+
Index: regression/games/filllib16.sgf
===================================================================
RCS file: regression/games/filllib16.sgf
diff -N regression/games/filllib16.sgf
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ regression/games/filllib16.sgf      11 Jun 2005 21:40:29 -0000
@@ -0,0 +1,11 @@
+(;GM[1]FF[4]
+CA[UTF-8]
+AP[Quarry:0.1.14]
+SZ[9]
+KM[0.0]
+C[S:6, D:0];B[ee]C[S:9, D:1];W[eg];B[dg];W[cc];B[eh];W[fh]
+;B[fg];W[gg];B[ff];W[ei];B[gh];W[dh];B[hh];W[df];B[cg];W[ch]
+;B[bg];W[ef];B[fd];W[be];B[de];W[cf];B[ec];W[db];B[eb];W[ea]
+;B[fa];W[da];B[gb];W[gi];B[gf];W[hi];B[ih];W[cd];B[ce];W[bd]
+;B[dc];W[cb];B[dd]
+)




reply via email to

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