summaryrefslogtreecommitdiff
path: root/c++
diff options
context:
space:
mode:
authorClaudius "keldu" Holeksa <mail@keldu.de>2023-12-01 16:12:57 +0100
committerClaudius "keldu" Holeksa <mail@keldu.de>2023-12-01 16:12:57 +0100
commit35e76eac52d5fbb370ddb92810d7daf4ea684beb (patch)
treecfb6f3bc58c7de48368721f74e6667a9b54c7286 /c++
parent031ec5a012d43854a581263d84a8d90bb26896c2 (diff)
core: Experimental changes to tree and mcts
Diffstat (limited to 'c++')
-rw-r--r--c++/core/mcts.h15
-rw-r--r--c++/core/tree.h7
2 files changed, 19 insertions, 3 deletions
diff --git a/c++/core/mcts.h b/c++/core/mcts.h
index 30eed2f..f0f3ba5 100644
--- a/c++/core/mcts.h
+++ b/c++/core/mcts.h
@@ -1,5 +1,20 @@
#pragma once
+#include "tree.h"
+
namespace saw {
+template<typename State>
+struct mcts_value {
+ State state;
+};
+template<typename State>
+class mcts_tree {
+private:
+ /**
+ * @todo
+ * Basically I need to a tree with tree<mcts_value<State>>
+ */
+public:
+};
}
diff --git a/c++/core/tree.h b/c++/core/tree.h
index 6316a5e..32572fc 100644
--- a/c++/core/tree.h
+++ b/c++/core/tree.h
@@ -25,7 +25,8 @@ private:
/**
* Object holding the treeed branch instances
*/
- std::vector<branch<T>> children_;
+ using branch = std::variant<T, tree<T>>;
+ std::vector<branch> children_;
public:
/**
* Default constructor
@@ -101,14 +102,14 @@ public:
/**
* Returns the branch at i
*/
- branch<T>& at(std::size_t i){
+ branch& at(std::size_t i){
return children_.at(i);
}
/**
* Returns the branch at i
*/
- const branch<T>& at(std::size_t i) const {
+ const branch& at(std::size_t i) const {
return children_.at(i);
}
};