From 3ccfbf72822111044015b5a454fd17d8c005d920 Mon Sep 17 00:00:00 2001 From: Petr Baudis Date: Thu, 10 Feb 2011 20:48:20 +0100 Subject: [PATCH] UCT tree.ltree_*: Switch back from color-to-play to black-to-play values --- uct/policy/ucb1amaf.c | 3 --- uct/tree.h | 5 ++--- uct/walk.c | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/uct/policy/ucb1amaf.c b/uct/policy/ucb1amaf.c index 37f81f1..60c96cc 100644 --- a/uct/policy/ucb1amaf.c +++ b/uct/policy/ucb1amaf.c @@ -92,9 +92,6 @@ ucb1rave_evaluate(struct uct_policy *p, struct tree *tree, struct uct_descent *d /* Local tree heuristics. */ if (p->uct->local_tree && b->ltree_rave > 0 && lnode) { struct move_stats l = lnode->u; - /* l.value is for color-to-play; convert to black-to-play - * to match the rest of the statistics. */ - l.value = tree_node_get_value(tree, parity, l.value); l.playouts = ((floating_t) l.playouts) * b->ltree_rave / LTREE_PLAYOUTS_MULTIPLIER; LTREE_DEBUG fprintf(stderr, "[ltree] adding [%s] %f%%%d to [%s] RAVE %f%%%d\n", coord2sstr(lnode->coord, tree->board), l.value, l.playouts, diff --git a/uct/tree.h b/uct/tree.h index 9fced26..81dd9eb 100644 --- a/uct/tree.h +++ b/uct/tree.h @@ -109,9 +109,8 @@ struct tree { * anywhere in the tree; nodes are created on-demand, special 'pass' * nodes represent tenuki. Only u move_stats are used, prior and amaf * is ignored. Values in root node are ignored. */ - /* The value corresponds to "local tactical utility" of the node. - * Higher is better! The values are true minimax, _not_ "black - * perspective" as in normal tree. */ + /* The value corresponds to black-to-play as usual; i.e. if white + * succeeds in its replies, the values will be low. */ struct tree_node *ltree_black; /* ltree_white has white-first sequences as children. */ struct tree_node *ltree_white; diff --git a/uct/walk.c b/uct/walk.c index 249f322..84d4c85 100644 --- a/uct/walk.c +++ b/uct/walk.c @@ -236,6 +236,7 @@ record_local_sequence(struct uct *u, struct tree *t, struct board *endb, while (di < dlen && (di == di0 || descent[di].node->d < u->tenuki_d)) { enum stone color = (di - di0) % 2 ? stone_other(seq_color) : seq_color; double rval = local_value(u, endb, descent[di].node->coord, color); + if (color == S_WHITE) rval = 1.0 - rval; LTREE_DEBUG fprintf(stderr, "%s[%s %1.3f][%d] ", coord2sstr(descent[di].node->coord, t->board), stone2str(color), rval, descent[di].node->d); -- 2.11.4.GIT