1 #ifndef ZZGO_UCT_TREE_H
2 #define ZZGO_UCT_TREE_H
15 * +------+ v- sibling +------+
16 * | node | ------------ | node |
19 * +------+ +------+ +------+ +------+
20 * | node | - | node | | node | - | node |
21 * +------+ +------+ +------+ +------+
25 int playouts
; // # of playouts coming through this node
26 int wins
; // # of wins coming through this node
27 float value
; // wins/playouts
32 struct tree_node
*parent
, *sibling
, *children
;
33 int depth
; // just for statistics
38 struct move_stats prior
;
39 /* XXX: Should be way for policies to add their own stats */
40 struct move_stats amaf
;
45 struct tree_node
*root
;
52 struct tree
*tree_init(struct board
*board
, enum stone color
);
53 void tree_done(struct tree
*tree
);
54 void tree_dump(struct tree
*tree
, int thres
);
56 void tree_expand_node(struct tree
*tree
, struct tree_node
*node
, struct board
*b
, enum stone color
, int radar
, struct uct_policy
*policy
, int parity
);
57 void tree_delete_node(struct tree
*tree
, struct tree_node
*node
);
58 void tree_promote_node(struct tree
*tree
, struct tree_node
*node
);
59 bool tree_leaf_node(struct tree_node
*node
);
60 void tree_update_node_value(struct tree_node
*node
, bool add_amaf
);