gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] changed board_hash after reading


From: Arend Bayer
Subject: Re: [gnugo-devel] changed board_hash after reading
Date: Fri, 2 Sep 2005 17:44:13 +0200 (CEST)

Gunnar wrote:
> Arend wrote:
> > I will take care of fixing the bug in the 2nd quoted code excerpt.
> 
> The fix in Martin's patch looks good to me.

Right. I hadn't fully understood the problem when I read Martin's patch,
and so it didn't make sense to me at the time. I am just running
regressions for this part of his patch (appended below) and will check
it in, so we have a baseline to judge the other changes against.

> > About the first: We could instead automatically reset komaster
> > to EMPTY in do_trymove() when a ko is resolved (and remove the above
> > code from komaster_trymove()). I am not sure what is best here.
> 
> This is also what Martin does. But is there actually any need for an
> automatic reset? It seems to me that this check could be done in
> komaster_trymove() after doing the move and that it's only meaningful
> for non-ko moves.

In fact, it seems outright wrong to me in the case of ko moves: we don't
want to reset the komaster in case of a two stage ko. (This may still
happen with your patch further down the search tree, I think.)

I still think it makes sense to do this in do_trymove(): It is the only
place where we can sensibly check that the ko wasn't resolved by
capturing the 2nd ko in a two stage ko.

Note also that it does happen that trymove() is used in reading when
komaster_trymove() is used at earlier and later stages in reading, but
the intervening trymove() may well resolve a ko.
Normalization of the komaster status might also help the caches.


Arend


Index: engine/board.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/board.c,v
retrieving revision 1.111
diff -u -p -r1.111 board.c
--- engine/board.c      12 Jun 2005 09:34:13 -0000      1.111
+++ engine/board.c      2 Sep 2005 15:33:54 -0000
@@ -1248,13 +1248,7 @@ komaster_trymove(int pos, int color, con
   *is_conditional_ko = 0;
   ko_move = is_ko(pos, color, &kpos);
 
-  if (!ko_move) {
-    if (komaster == WEAK_KO) {
-      set_new_komaster(EMPTY);
-      set_new_kom_pos(NO_MOVE);
-    }
-  }
-  else {
+  if (ko_move) {
     /* If opponent is komaster we may not capture his ko. */
     if (komaster == other && pos == kom_pos)
       return 0;
@@ -1293,8 +1287,13 @@ komaster_trymove(int pos, int color, con
     }
   }
 
-  if (!ko_move)
+  if (!ko_move) {
+    if (komaster == WEAK_KO) {
+      set_new_komaster(EMPTY);
+      set_new_kom_pos(NO_MOVE);
+    }
     return 1;
+  }
 
   if (komaster == other) {
     if (color == WHITE)




reply via email to

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