[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] bug report
From: |
Gunnar Farneback |
Subject: |
Re: [gnugo-devel] bug report |
Date: |
Wed, 07 Jan 2004 15:46:18 +0100 |
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) |
Paul wrote:
> Btw, GNU Go on KGS is not run by GNU Go team -- AFAIK it is run by
> someone from the KGS team, perhaps William Shubert.
I've been running one instance of GNU Go there for a few days to test
that the GTP bridge is working correctly. Otherwise there seems to be
a couple of GTP robots run by random people, mostly featuring GNU Go.
The patch below implements the KGS specific command
kgs-genmove_cleanup, used to resolve status disputes at the end of
games under non-Japanese rules.
/Gunnar
Index: doc/gtp-commands.texi
===================================================================
RCS file: /cvsroot/gnugo/gnugo/doc/gtp-commands.texi,v
retrieving revision 1.19
diff -u -r1.19 gtp-commands.texi
--- doc/gtp-commands.texi 18 Nov 2003 08:55:46 -0000 1.19
+++ doc/gtp-commands.texi 7 Jan 2004 14:27:12 -0000
@@ -874,6 +874,24 @@
@end example
address@hidden kgs-genmove_cleanup
address@hidden kgs-genmove_cleanup
+
address@hidden
+
+ Function: Generate and play the supposedly best move for either color,
+ not passing until all dead opponent stones have been removed.
+ Arguments: color to move
+ Fails: invalid color
+ Returns: a move coordinate (or "PASS")
+
+ Status: KGS specific command.
+
+ A similar command, but possibly somewhat different, will likely be added
+ to GTP version 3 at a later time.
+
address@hidden example
+
@cindex level
@item level
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.137
diff -u -r1.137 play_gtp.c
--- interface/play_gtp.c 30 Dec 2003 23:39:56 -0000 1.137
+++ interface/play_gtp.c 7 Jan 2004 14:27:27 -0000
@@ -125,6 +125,7 @@
DECLARE(gtp_initial_influence);
DECLARE(gtp_is_legal);
DECLARE(gtp_is_surrounded);
+DECLARE(gtp_kgs_genmove_cleanup);
DECLARE(gtp_known_command);
DECLARE(gtp_ladder_attack);
DECLARE(gtp_last_move);
@@ -258,6 +259,7 @@
{"initial_influence", gtp_initial_influence},
{"is_legal", gtp_is_legal},
{"is_surrounded", gtp_is_surrounded},
+ {"kgs-genmove_cleanup", gtp_kgs_genmove_cleanup},
{"known_command", gtp_known_command},
{"komi", gtp_set_komi},
{"ladder_attack", gtp_ladder_attack},
@@ -2530,6 +2532,53 @@
}
+/* Function: Generate and play the supposedly best move for either color,
+ * not passing until all dead opponent stones have been removed.
+ * Arguments: color to move
+ * Fails: invalid color
+ * Returns: a move coordinate (or "PASS")
+ *
+ * Status: KGS specific command.
+ *
+ * A similar command, but possibly somewhat different, will likely be added
+ * to GTP version 3 at a later time.
+ */
+static int
+gtp_kgs_genmove_cleanup(char *s)
+{
+ int i, j;
+ int color;
+ int n;
+ float val;
+ int save_capture_all_dead = capture_all_dead;
+
+ n = gtp_decode_color(s, &color);
+ if (!n)
+ return gtp_failure("invalid color");
+
+ if (stackp > 0)
+ return gtp_failure("kgs-genmove_cleanup cannot be called when stackp > 0");
+
+ /* Turn on the capture_all_dead option to force removal of dead
+ * opponent stones.
+ */
+ capture_all_dead = 1;
+
+ adjust_level_offset(color);
+ level += level_offset;
+ val = genmove(&i, &j, color);
+ level -= level_offset;
+
+ capture_all_dead = save_capture_all_dead;
+
+ play_move(POS(i, j), color);
+
+ gtp_start_response(GTP_SUCCESS);
+ gtp_print_vertex(i, j);
+ return gtp_finish_response();
+}
+
+
/* Function : List the move reasons for a move.
* Arguments: vertex
* Fails: : invalid vertex, occupied vertex