gnugo-devel
[Top][All Lists]
Advanced

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

Re: [gnugo-devel] Irregular edges


From: Gunnar Farneback
Subject: Re: [gnugo-devel] Irregular edges
Date: Tue, 16 Oct 2001 08:05:07 +0200
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)

Dan wrote:
> I assume this to the NEEDS_UPDATE scheme.

Yes.

> Inge wrote:
> 
> > I simple fix would be to cache the generated move reasons in the
> > worm[] and dragon[] arrays.  Then they could be quickly reissued when
> > examine_position is called again.
> 
> and Gunnar seemed to endorse this idea. I think we do
> need to do something about this.

Not exactly. A better solution is to keep track of all attack points
and so on in the worm and dragon arrays and then generate move reasons
from them. This has already been implemented for the worms, see e.g.
the new function worm_reasons(). Similar changes still need to be done
with dragon and eye data.

But in the mean time I think this patch will solve the immediate
problem. It implements a "top_moves" command which doesn't call
genmove() itself but instead reports the top moves from the previous
genmove command. I think this is what you usually want and that the
existing "top_moves_white" and "top_moves_black" commands can be
removed.

/Gunnar

Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.32
diff -u -r1.32 play_gtp.c
--- interface/play_gtp.c        2001/10/15 17:59:51     1.32
+++ interface/play_gtp.c        2001/10/16 06:03:19
@@ -130,6 +130,7 @@
 DECLARE(gtp_set_komi);
 DECLARE(gtp_set_level);
 DECLARE(gtp_showboard);
+DECLARE(gtp_top_moves);
 DECLARE(gtp_top_moves_white);
 DECLARE(gtp_top_moves_black);
 DECLARE(gtp_trymove);
@@ -202,6 +203,7 @@
   {"reset_trymove_counter",   gtp_reset_trymove_counter},
   {"same_dragon",            gtp_same_dragon},
   {"showboard",                      gtp_showboard},
+  {"top_moves",               gtp_top_moves},
   {"top_moves_black",         gtp_top_moves_black},
   {"top_moves_white",         gtp_top_moves_white},
   {"trymove",                        gtp_trymove},
@@ -1252,6 +1254,30 @@
   gtp_printid(id, GTP_SUCCESS);
   gtp_print_vertex(i, j);
   return gtp_finish_response();
+}
+
+/* Function : Generate a list of the best moves in the previous genmove
+ *            command (either of genmove_black, genmove_white, gg_genmove).
+ *            If no previous genmove command has been issued, the result
+ *            of this command will be meaningless.
+ * Arguments: none
+ * Fails:   : never
+ * Returns  : list of moves with weights
+ */
+
+static int
+gtp_top_moves(char *s, int id)
+{
+  int i, j, k;
+  UNUSED(s);
+  gtp_printid(id, GTP_SUCCESS);
+  for (k = 0; k < 10; k++)
+    if (best_move_values[k] > 0.0) {
+      gtp_print_vertex(best_movei[k], best_movej[k]);
+      gtp_printf(" %.2f ", best_move_values[k]);
+    }
+  gtp_printf("\n\n");
+  return GTP_OK;
 }
 
 /* Function : Generate a list of the best moves for White with weights



reply via email to

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