[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnugo-devel] owl goal in sgf trees
From: |
Arend Bayer |
Subject: |
[gnugo-devel] owl goal in sgf trees |
Date: |
Fri, 27 Aug 2004 21:13:02 +0200 (CEST) |
- mark owl goal in sgf trees
This is very much needed now that the owl goal can get split up.
Arend
Index: engine/board.h
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/board.h,v
retrieving revision 1.13
diff -u -p -r1.13 board.h
--- engine/board.h 7 Jun 2004 17:18:54 -0000 1.13
+++ engine/board.h 27 Aug 2004 19:12:31 -0000
@@ -387,6 +387,8 @@ int is_hoshi_point(int m, int n);
void draw_letter_coordinates(FILE *outfile);
void simple_showboard(FILE *outfile);
+void mark_goal_in_sgf(char goal[BOARDMAX]);
+
/* ================================================================ */
/* assertions */
/* ================================================================ */
Index: engine/owl.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/owl.c,v
retrieving revision 1.219
diff -u -p -r1.219 owl.c
--- engine/owl.c 24 Aug 2004 14:39:53 -0000 1.219
+++ engine/owl.c 27 Aug 2004 19:12:33 -0000
@@ -1246,6 +1246,8 @@ semeai_trymove_and_recurse(int apos, int
owl_update_goal(move, same_dragon, lunch, owlb, 1);
owl_update_boundary_marks(move, owla);
}
+ mark_goal_in_sgf(owla->goal);
+ mark_goal_in_sgf(owlb->goal);
/* Do a recursive call to read the semeai after the move we just
* tried. If dragon b was captured by the move, call
@@ -2083,8 +2085,10 @@ do_owl_attack(int str, int *move, int *w
}
}
+ /* Test whether the move cut the goal dragon apart. */
if (moves[k].cuts[0] != NO_MOVE)
owl_test_cuts(owl->goal, owl->color, moves[k].cuts);
+ mark_goal_in_sgf(owl->goal);
if (origin == NO_MOVE)
dcode = 0;
@@ -2658,6 +2662,7 @@ do_owl_defend(int str, int *move, int *w
* pattern explicitly asked for not doing this.
*/
owl_update_goal(mpos, moves[k].same_dragon, moves[k].lunch, owl, 0);
+ mark_goal_in_sgf(owl->goal);
if (!ko_move) {
int acode = do_owl_attack(str, NULL, &wid, owl, new_escape);
Index: engine/printutils.c
===================================================================
RCS file: /cvsroot/gnugo/gnugo/engine/printutils.c,v
retrieving revision 1.47
diff -u -p -r1.47 printutils.c
--- engine/printutils.c 8 Jul 2004 15:32:25 -0000 1.47
+++ engine/printutils.c 27 Aug 2004 19:12:33 -0000
@@ -23,6 +23,7 @@
#include "board.h"
#include "hash.h"
#include "gg_utils.h"
+#include "sgftree.h"
#include <stdio.h>
#include <string.h>
@@ -509,6 +510,25 @@ simple_showboard(FILE *outfile)
}
+/* Adds square marks for each goal intersecion in the current sgf_dumptree.
+ * This function cannot be in sgf/ as it has to understand the 1-D board.
+ */
+void
+mark_goal_in_sgf(char goal[BOARDMAX])
+{
+ int pos;
+ SGFNode *node;
+
+ if (!sgf_dumptree)
+ return;
+ node = sgftreeNodeCheck(sgf_dumptree);
+
+ for (pos = BOARDMIN; pos < BOARDMAX; pos++)
+ if (ON_BOARD(pos) && goal[pos])
+ sgfSquare(node, I(pos), J(pos));
+}
+
+
/*
* Local Variables:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnugo-devel] owl goal in sgf trees,
Arend Bayer <=