aboutsummaryrefslogtreecommitdiff
path: root/src/main/solver/solver.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/solver/solver.h')
-rw-r--r--src/main/solver/solver.h16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/main/solver/solver.h b/src/main/solver/solver.h
index ef0709a..14dedc5 100644
--- a/src/main/solver/solver.h
+++ b/src/main/solver/solver.h
@@ -18,15 +18,13 @@ public:
lru_cache cache;
struct node {
- node(node*, move, boost::optional<lru_cache::item_list::iterator> = boost::none);
- node* parent;
+ node(move);
const move mv;
- std::vector<node> children;
- boost::optional<lru_cache::item_list::iterator> parent_state_iter; // Optional, as dominance moves aren't cached
+ std::vector<move> child_moves;
+ boost::optional<lru_cache::item_list::iterator> cache_state; // Optional, as dominance moves aren't cached
};
explicit solver(const game_state&, uint64_t);
- ~solver();
sol_state run(boost::optional<std::atomic<bool> &> = boost::none);
@@ -36,15 +34,15 @@ public:
int get_unique_states_searched() const;
int get_cache_size() const;
int get_states_rem_from_cache() const;
- const node& get_search_tree() const;
+ const std::vector<node> get_frontier() const;
private:
bool revert_to_last_node_with_children(boost::optional<lru_cache::item_list::iterator> = boost::none);
- void add_children(std::vector<move>&, boost::optional<lru_cache::item_list::iterator> = boost::none);
- void add_child(move, boost::optional<lru_cache::item_list::iterator> = boost::none);
+ void set_to_child();
const game_state init_state;
game_state state;
+ std::vector<node> frontier;
int states_searched;
int unique_states_searched;
@@ -54,7 +52,7 @@ private:
int max_depth;
node root;
- node* current_node;
+ std::vector<node>::iterator current_node;
};