OJD db: tree_node_archive.tree_pos references back tree_node.id
[eidogo-ojd.git] / gnugo / score_est.patch
blob430270283d3369e35a27c661bff261911aee7633
1 Index: interface/play_solo.c
2 ===================================================================
3 RCS file: /sources/gnugo/gnugo/interface/play_solo.c,v
4 retrieving revision 1.46
5 diff -u -r1.46 play_solo.c
6 --- interface/play_solo.c 24 Oct 2007 01:56:04 -0000 1.46
7 +++ interface/play_solo.c 15 Jan 2008 07:22:14 -0000
8 @@ -32,6 +32,8 @@
10 #include "liberty.h" /* to get to the stats */
12 +#include "influence.h"
14 #include "sgftree.h"
15 #include "random.h"
16 #include "gg_utils.h"
17 @@ -190,7 +192,7 @@
18 int move;
19 float move_value;
20 char *tempc = NULL;
21 - char text[250];
22 + char text[4096];
23 char winner;
24 int next;
25 int pass = 0;
26 @@ -198,6 +200,11 @@
27 float score;
28 SGFTree local_tree;
29 SGFTree *score_tree = tree;
30 + signed char safe_stones[BOARDMAX];
31 + float strength[BOARDMAX];
32 + int ii;
33 + struct influence_data move_influence;
34 + char coord[3];
36 /* Default scoring method is ESTIMATE since it's fastest. */
37 method = ESTIMATE;
38 @@ -274,7 +281,31 @@
40 fputs(text, stdout);
41 sgftreeAddComment(score_tree, text);
44 + /* Find points of territory for white */
45 + set_strength_data(WHITE, safe_stones, strength);
46 + compute_influence(EMPTY, safe_stones, strength, &move_influence,
47 + NO_MOVE, "White territory estimate");
48 + for (ii = BOARDMIN; ii < BOARDMAX; ii++)
49 + if (ON_BOARD(ii))
50 + if (move_influence.territory_value[ii] > 0.5) {
51 + sprintf(coord, "%c%c", J(ii)+'a', I(ii)+'a');
52 + sgfAddProperty(sgftreeNodeCheck(score_tree), "TW", coord);
53 + printf("TW:%s ", coord);
54 + }
56 + /* ...and for black */
57 + set_strength_data(BLACK, safe_stones, strength);
58 + compute_influence(EMPTY, safe_stones, strength, &move_influence,
59 + NO_MOVE, "Black territory estimate");
60 + for (ii = BOARDMIN; ii < BOARDMAX; ii++)
61 + if (ON_BOARD(ii))
62 + if (move_influence.territory_value[ii] < -0.5) {
63 + sprintf(coord, "%c%c", J(ii)+'a', I(ii)+'a');
64 + sgfAddProperty(sgftreeNodeCheck(score_tree), "TB", coord);
65 + printf("TB:%s ", coord);
66 + }
68 /* For the finish and aftermath methods we compare the score with
69 * what's stored in the game record.