diff options
| author | Charlie Blake | 2017-11-13 09:52:23 +0000 |
|---|---|---|
| committer | GitHub | 2017-11-13 09:52:23 +0000 |
| commit | 96f9d446750e07c039ce5d482c92c464593c5bc9 (patch) | |
| tree | 5731e7eee2c041166479585daab804bc6d8e445c /src/main/solver/solver.h | |
| parent | Merge pull request #19 from thecharlesblake/canfield (diff) | |
| parent | Refactor solver (diff) | |
| download | metasol-96f9d446750e07c039ce5d482c92c464593c5bc9.tar.gz metasol-96f9d446750e07c039ce5d482c92c464593c5bc9.zip | |
Merge pull request #20 from thecharlesblake/initial-code-cleanup
Initial code cleanup
Diffstat (limited to 'src/main/solver/solver.h')
| -rw-r--r-- | src/main/solver/solver.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/main/solver/solver.h b/src/main/solver/solver.h new file mode 100644 index 0000000..91c93d6 --- /dev/null +++ b/src/main/solver/solver.h @@ -0,0 +1,43 @@ +// +// Created by thecharlesblake on 10/24/17. +// + +#ifndef SOLVITAIRE_SOLVER_H +#define SOLVITAIRE_SOLVER_H + +#include <string> +#include <vector> + +#include <boost/optional.hpp> + +#include "game/game_state.h" +#include "game/sol_rules.h" + +class solver { +public: + struct node { + node(const node*, const game_state&); + std::vector<game_state> history; + game_state state; + + static const std::vector<game_state> gen_history(const node* parent); + }; + + solver(const game_state, const sol_rules&); + + const node get_root() const; + int get_states_searched() const; + + const boost::optional<node> run(); + + friend std::ostream& operator<< (std::ostream&, const solver::node&); + +private: + const node root; + const sol_rules rules; + node solution; + int states_searched; +}; + + +#endif //SOLVITAIRE_SOLVER_H |
