gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Current CVS very broken


From: Daniel Bump
Subject: Re: [gnugo-devel] Current CVS very broken
Date: Mon, 29 Oct 2001 06:29:04 -0800

I've been examining the example that Trevor gave where
GNU Go makes an illegal move. What happens is this: 
In checking the safety of A8, atari_atari_confirm_safety
tries the move, then passes control to do_atari_atari
which looks for combinations. It finds the sequence
W:A8, B:B9, W:A9 after which there's a snapback. At this
point, W:A5 defends, in the sense that if W is allowed a
move at A5 (capturing two stones) instead of A9 then the
snapback is gone.

The function do_atari_atari is recursive and passes
the defensive move up to the higher level. Usually if
a move defends at a deeper level then it should defend
at the top level but if something gets captured along
the way all bets are off. In this case, A5 is
not only a poor defense but actually illegal.

The following patch fixes this. I included an assertion
which might cause some crashes if this fix is inadequate.
I'll wait a bit before putting this in the CVS.

- do_atari_atari confirms the *defense_point is safe before returning
- atari_atari_confirm_safety initializes defense_point


Index: engine/reading.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/reading.c,v
retrieving revision 1.28
diff -u -r1.28 reading.c
--- engine/reading.c    2001/10/28 14:38:17     1.28
+++ engine/reading.c    2001/10/29 14:14:14
@@ -1150,7 +1150,8 @@
                 * move for other, it probably defends the combination.
                 */
                if (defense_point 
-                   && *defense_point == NO_MOVE
+                   && (*defense_point == NO_MOVE
+                       || !safe_move(*defense_point, other))
                    && safe_move(apos, other)) {
                  *defense_point = apos;
                }
@@ -1177,7 +1178,7 @@
 atari_atari_confirm_safety(int color, int tpos, int *move, int minsize)
 {
   int fpos;
-  int defense_point, after_defense_point;
+  int defense_point = NO_MOVE, after_defense_point = NO_MOVE;
   int aa_val, after_aa_val;
   int other = OTHER_COLOR(color);
 



reply via email to

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