aboutsummaryrefslogtreecommitdiff
path: root/src/main/solver/solver.h
diff options
context:
space:
mode:
authorthecharlesblake2017-11-15 21:22:40 +0000
committerthecharlesblake2017-11-15 21:22:40 +0000
commitfb20d1289ce87234bfae2cb8d784d9edf1d3ff16 (patch)
tree3ac8c53538ee65d3361fb7f879e5685b90af9aff /src/main/solver/solver.h
parentMake simple-spanish-patience easier (diff)
downloadmetasol-fb20d1289ce87234bfae2cb8d784d9edf1d3ff16.tar.gz
metasol-fb20d1289ce87234bfae2cb8d784d9edf1d3ff16.zip

Change history to boost multi-index map

Diffstat (limited to 'src/main/solver/solver.h')
-rw-r--r--src/main/solver/solver.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/main/solver/solver.h b/src/main/solver/solver.h
index 91c93d6..73e5e24 100644
--- a/src/main/solver/solver.h
+++ b/src/main/solver/solver.h
@@ -9,18 +9,30 @@
#include <vector>
#include <boost/optional.hpp>
+#include <boost/multi_index/hashed_index.hpp>
+#include <boost/multi_index_container.hpp>
+#include <boost/multi_index/identity.hpp>
+#include <boost/multi_index/sequenced_index.hpp>
#include "game/game_state.h"
#include "game/sol_rules.h"
class solver {
public:
+ typedef boost::multi_index::multi_index_container<
+ game_state,
+ boost::multi_index::indexed_by<
+ boost::multi_index::sequenced<>,
+ boost::multi_index::hashed_unique<boost::multi_index::identity<game_state>>
+ >
+ > node_history;
+
struct node {
node(const node*, const game_state&);
- std::vector<game_state> history;
+ node_history history;
game_state state;
- static const std::vector<game_state> gen_history(const node* parent);
+ static const node_history gen_history(const node* parent);
};
solver(const game_state, const sol_rules&);
@@ -33,6 +45,7 @@ public:
friend std::ostream& operator<< (std::ostream&, const solver::node&);
private:
+
const node root;
const sol_rules rules;
node solution;