| 16 | namespace tree { |
| 17 | |
| 18 | class CNode { |
| 19 | public: |
| 20 | int visit_count, to_play, action_num, hidden_state_index_x, hidden_state_index_y, best_action, is_reset; |
| 21 | float value_prefix, prior, value_sum; |
| 22 | std::vector<int> children_index; |
| 23 | std::vector<CNode>* ptr_node_pool; |
| 24 | |
| 25 | CNode(); |
| 26 | CNode(float prior, int action_num, std::vector<CNode> *ptr_node_pool); |
| 27 | ~CNode(); |
| 28 | |
| 29 | void expand(int to_play, int hidden_state_index_x, int hidden_state_index_y, float value_prefix, const std::vector<float> &policy_logits); |
| 30 | void add_exploration_noise(float exploration_fraction, const std::vector<float> &noises); |
| 31 | float get_mean_q(int isRoot, float parent_q, float discount); |
| 32 | void print_out(); |
| 33 | |
| 34 | int expanded(); |
| 35 | |
| 36 | float value(); |
| 37 | |
| 38 | std::vector<int> get_trajectory(); |
| 39 | std::vector<int> get_children_distribution(); |
| 40 | CNode* get_child(int action); |
| 41 | }; |
| 42 | |
| 43 | class CRoots{ |
| 44 | public: |