[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gnugo-devel] Patch: GTP: Getting komi and handicap
From: |
Heikki Levanto |
Subject: |
Re: [gnugo-devel] Patch: GTP: Getting komi and handicap |
Date: |
Sun, 27 Jan 2002 15:23:32 +0100 |
User-agent: |
Mutt/1.2.5i |
On Sun, Jan 27, 2002 at 02:50:38PM +0100, Heikki Levanto wrote:
> Here's another little patch to the GTP.
I must be too tired to work. I left outr the patch itself. Here goes:
diff -ruN gnugo-ref/interface/play_gtp.c gnugo-work/interface/play_gtp.c
--- gnugo-ref/interface/play_gtp.c Thu Dec 20 20:54:16 2001
+++ gnugo-work/interface/play_gtp.c Sun Jan 27 14:42:09 2002
@@ -91,6 +91,7 @@
DECLARE(gtp_findlib);
DECLARE(gtp_finish_sgftrace);
DECLARE(gtp_fixed_handicap);
+DECLARE(gtp_get_handicap);
DECLARE(gtp_genmove);
DECLARE(gtp_genmove_black);
DECLARE(gtp_genmove_white);
@@ -135,7 +136,7 @@
DECLARE(gtp_same_dragon);
DECLARE(gtp_set_boardsize);
DECLARE(gtp_set_orientation);
-DECLARE(gtp_set_komi);
+DECLARE(gtp_komi);
DECLARE(gtp_set_level);
DECLARE(gtp_showboard);
DECLARE(gtp_start_sgftrace);
@@ -182,6 +184,7 @@
{"findlib", gtp_findlib},
{"finish_sgftrace", gtp_finish_sgftrace},
{"fixed_handicap", gtp_fixed_handicap},
+ {"get_handicap", gtp_get_handicap},
{"genmove_black", gtp_genmove_black},
{"genmove_white", gtp_genmove_white},
{"get_connection_node_counter", gtp_get_connection_node_counter},
@@ -194,7 +197,7 @@
{"increase_depths", gtp_increase_depths},
{"influence", gtp_influence},
{"is_legal", gtp_is_legal},
- {"komi", gtp_set_komi},
+ {"komi", gtp_komi},
{"level", gtp_set_level},
{"list_stones", gtp_list_stones},
{"loadsgf", gtp_loadsgf},
@@ -423,19 +427,19 @@
}
/***************************
- * Setting komi. *
+ * Setting/querying komi *
***************************/
-/* Function: Set the komi.
- * Arguments: float
- * Fails: incorrect argument
- * Returns: nothing
+/* Function: Set the komi or return it
+ * Arguments: float to set or none to query
+ * Fails: never
+ * Returns: nothing or the komi
*/
static int
-gtp_set_komi(char *s, int id)
+gtp_komi(char *s, int id)
{
if (sscanf(s, "%f", &komi) < 1)
- return gtp_failure(id, "komi not a float");
+ return gtp_success(id, "%4.1f",komi);
return gtp_success(id, "");
}
@@ -548,6 +552,18 @@
}
+/* Function: Get the handicap
+ * Arguments: none
+ * Fails: never
+ * Returns: handicap
+ */
+static int
+gtp_get_handicap(char *s, int id)
+{
+ s=s; /* compiler shut up */
+ return gtp_success(id, "%d", handicap);
+}
+
/* Function: Load an sgf file, possibly up to a move number or the first
* occurence of a move.
* Arguments: filename + move number, vertex, or nothing
--
Heikki Levanto LSD - Levanto Software Development <address@hidden>
- [gnugo-devel] Patch: GTP:worm_data:origin, Heikki Levanto, 2002/01/26
- Re: [gnugo-devel] Patch: GTP:worm_origins, Heikki Levanto, 2002/01/26
- Re: [gnugo-devel] Patch: GTP:worm_origins, Gunnar Farneback, 2002/01/26
- Re: [gnugo-devel] Patch: GTP:worm_origins, Heikki Levanto, 2002/01/27
- Re: [gnugo-devel] Patch: GTP:worm_origins, Daniel Bump, 2002/01/27
- Re: [gnugo-devel] Patch: GTP:worm_origins, Gunnar Farneback, 2002/01/27
- [gnugo-devel] Re: Patch: GTP:worm_origins, Heikki Levanto, 2002/01/27
- Re: [gnugo-devel] Re: Patch: GTP:worm_origins, Gunnar Farneback, 2002/01/27
- [gnugo-devel] Patch: GTP: Getting komi and handicap, Heikki Levanto, 2002/01/27
- Re: [gnugo-devel] Patch: GTP: Getting komi and handicap,
Heikki Levanto <=