[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] trevor_1_14.6
From: |
Trevor Morris |
Subject: |
[gnugo-devel] trevor_1_14.6 |
Date: |
Fri, 16 Nov 2001 11:56:05 -0500 |
http://www.public32.com/games/go/trevor_1_14.6
- Adds sgf file optional parameter to owl_attack
Assuming this is OK w/ all, I'll add same to owl_defend shortly.
-Trevor
Index: interface/play_gtp.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/interface/play_gtp.c,v
retrieving revision 1.44
diff -u -r1.44 play_gtp.c
--- interface/play_gtp.c 2001/11/15 17:56:06 1.44
+++ interface/play_gtp.c 2001/11/16 16:50:17
@@ -841,9 +841,10 @@
******************/
/* Function: Try to attack a dragon.
- * Arguments: vertex
+ * Arguments: vertex (sgffilename - optional)
* Fails: invalid vertex, empty vertex
* Returns: attack code followed by attack point if attack code nonzero.
+ * optionally, writes sgf trace to provided file.
*/
static int
gtp_owl_attack(char *s, int id)
@@ -853,10 +854,17 @@
int attack_code;
int save_verbose = verbose;
int result_certain;
+ SGFTree tree;
+ char ignore[31];
+ char sgffilename[255];
if (!gtp_decode_coord(s, &i, &j))
return gtp_failure(id, "invalid coordinate");
+ if (!sscanf(s, "%s %s", ignore, sgffilename)) {
+ sgffilename[0] = 0;
+ }
+
if (BOARD(i, j) == EMPTY)
return gtp_failure(id, "vertex must not be empty");
@@ -864,7 +872,13 @@
examine_position(BOARD(i, j), EXAMINE_DRAGONS_WITHOUT_OWL);
verbose = save_verbose;
+ if (sgffilename[0])
+ begin_sgftreedump(&tree);
attack_code = owl_attack(POS(i, j), &attack_point, &result_certain);
+ if (sgffilename[0])
+ end_sgftreedump(sgffilename);
+ /* FIXME: (?) need to free tree? See also same call in
gtp_finish_sgftrace.*/
+
gtp_printid(id, GTP_SUCCESS);
gtp_print_code(attack_code);
if (attack_code > 0) {
@@ -2247,7 +2261,6 @@
gtp_printf("\n");
return GTP_OK;
}
-
static SGFTree gtp_sgftree;
- [gnugo-devel] trevor_1_14.6,
Trevor Morris <=