gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] bugfix


From: Arend Bayer
Subject: Re: [gnugo-devel] bugfix
Date: Fri, 15 Nov 2002 15:26:52 +0100 (CET)

Paul Pogonyshev wrote:

> > [bug somewhere else]
>
> ok, i'm not going to work with it, but here is how i came up with the patch
> (if it helps you):
>
> i was studying one of the tests (either 161 or 302) and for some reason used
> dragon_data command. i discovered that dragon_data and dragon_status command
> were giving different results. since owl_attack and owl_defend agreed with
> dragon_data, i tried to fix gtp_dragon_status() and changed the call to
> silent_examine_position() to use EMPTY instead of BLACK, like in
> gtp_dragon_data().

That means we have to fix gtp_dragon_data().

There is also a bug in examine_position with regards to the caching.
(Would show up if a gtp_dragon_data or owl_attack etc. is followed by a
genmove.)
I don't see why examine_position should have the color parameter at all,
btw. Killing this would be in line with Gunnar's comment about removing
move generation from the examine position phase.

Arend

(Patch not yet tested. It might also slow down regressions.)


Index: engine/genmove.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/genmove.c,v
retrieving revision 1.55
diff -u -p -r1.55 genmove.c
--- engine/genmove.c    14 Nov 2002 16:49:53 -0000      1.55
+++ engine/genmove.c    15 Nov 2002 14:25:56 -0000
@@ -109,8 +109,23 @@ void
 examine_position(int color, int how_much)
 {
   int save_verbose = verbose;
+  static int last_color = GRAY;

   purge_persistent_reading_cache();
+
+  /* Invalidate caching if previous call was with different color.
+   * FIXME: I think examine_position() should not have the color
+   * parameter at all. /ab
+   */
+  if (color != last_color) {
+    worms_examined = -1;
+    initial_influence_examined = -1;
+    dragons_examined_without_owl = -1;
+    dragons_examined = -1;
+    initial_influence2_examined = -1;
+    dragons_refinedly_examined = -1;
+    last_color = color;
+  }

   /* Don't print reading traces during make_worms and make_dragons unless
    * the user really wants it (verbose == 3).
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.102
diff -u -p -r1.102 play_gtp.c
--- interface/play_gtp.c        14 Nov 2002 16:49:54 -0000      1.102
+++ interface/play_gtp.c        15 Nov 2002 14:26:28 -0000
@@ -3185,7 +3185,7 @@ gtp_dragon_data(char *s)
   if (stackp > 0)
     return gtp_failure("dragon data unavailable when stackp > 0");

-  examine_position(EMPTY, FULL_EXAMINE_DRAGONS);
+  examine_position(BLACK, FULL_EXAMINE_DRAGONS);

   gtp_start_response(GTP_SUCCESS);







reply via email to

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