libmcts
A Monte Carlo Tree Search Library
root_node.hpp
1 #ifndef ROOT_NODE_H
2 #define ROOT_NODE_H
3 
4 #include "inode.hpp"
5 
6 namespace mcts {
7 
8 // ----------------------------------------------------------------------
16 // ----------------------------------------------------------------------
17 template <typename Context, typename Config, typename WrapNode>
18 class RootNode : public WrapNode {
19  typedef typename INode<Context, Config>::node_t node_t;
20 
21 public:
23 
24  // ----------------------------------------------------------------------
30  // ----------------------------------------------------------------------
31  RootNode(const Context &context, Config *config)
32  : WrapNode(context, config, NULL) {}
33 
34  // ----------------------------------------------------------------------
38  // ----------------------------------------------------------------------
39  virtual node_t *parent() const { return NULL; }
40 
41  // ----------------------------------------------------------------------
45  // ----------------------------------------------------------------------
46  virtual void backpropagate(const double &value) {
47  WrapNode::backprop_strat_->on_backpropagate(value);
48  }
49 
50  // ----------------------------------------------------------------------
52  // ----------------------------------------------------------------------
53  using WrapNode::select_child;
54 };
55 }
56 
57 #endif
RootNode(const Context &context, Config *config)
constructs a new object and passes all parameters to the wrapped node.
Definition: root_node.hpp:31
special node that is the root of each tree. Its merely a wrapper that wrapps around a inner node.
Definition: root_node.hpp:18
basic interface for a node in the tree. Every node has to implement this functions.
Definition: inode.hpp:18
virtual node_t * parent() const
disabled in root node, to end backpropagating actions.
Definition: root_node.hpp:39
virtual void backpropagate(const double &value)
consume value and do noting more.
Definition: root_node.hpp:46