From ce4be63b218aaf0ab87481e90fad1407f54bca1f Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 14 Feb 2018 16:43:11 +0000 Subject: Update solver logic: simpler & handles dominances --- src/main/solver/solver.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src/main/solver/solver.h') diff --git a/src/main/solver/solver.h b/src/main/solver/solver.h index 526bd53..9488dda 100644 --- a/src/main/solver/solver.h +++ b/src/main/solver/solver.h @@ -6,6 +6,7 @@ #define SOLVITAIRE_SOLVER_H #include +#include #include #include "../game/global_cache.h" @@ -16,20 +17,30 @@ public: global_cache cache; struct node { - explicit node(game_state::move, std::vector); + node(node*, game_state::move); + node* parent; const game_state::move move; - std::vector unsearched_children; + std::list children; }; explicit solver(const game_state&); bool run(); void print_solution() const; + int get_states_searched() const; + const node& get_search_tree() const; private: - const game_state initial_state; - std::vector frontier; + bool revert_to_last_node_with_children(); + void add_children(std::vector&); + void add_child(game_state::move); + + const game_state init_state; + game_state state; int states_searched; + + node root; + node* current_node; }; -- cgit v1.2.1