aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/global_cache.h
diff options
context:
space:
mode:
authorthecharlesblake2018-01-18 13:53:51 +0000
committerthecharlesblake2018-01-18 13:53:51 +0000
commit4c328ff6bd2fadbebb48753c28edee32a6695848 (patch)
tree40ddcfbbf0743e959758d7189e9c28b54b09ee84 /src/main/game/global_cache.h
parentUpdate game state with static pile refs & rules (diff)
downloadmetasol-4c328ff6bd2fadbebb48753c28edee32a6695848.tar.gz
metasol-4c328ff6bd2fadbebb48753c28edee32a6695848.zip

Revamp basic global cache class

Diffstat (limited to 'src/main/game/global_cache.h')
-rw-r--r--src/main/game/global_cache.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/main/game/global_cache.h b/src/main/game/global_cache.h
index 73f0ce7..a3d1e48 100644
--- a/src/main/game/global_cache.h
+++ b/src/main/game/global_cache.h
@@ -8,24 +8,27 @@
#include <vector>
#include <unordered_set>
-#include "../game/game_state.h"
-#include "../game/sol_rules.h"
+#include <boost/functional/hash.hpp>
+
+#include "sol_rules.h"
+#include "game_state.h"
class global_cache {
public:
- explicit global_cache(game_state);
-
- bool insert(const std::vector<pile>&);
- bool contains(const std::vector<pile>&);
-
- friend std::size_t hash_value(card const&);
- friend std::size_t hash_value(std::vector<pile> const&);
+ bool insert(const game_state&);
+ bool contains(const game_state&) const;
+ void clear();
+
+ struct game_state_pred {
+ static bool comp_pile(const pile& x, const pile& y);
+ bool operator() (const game_state& x, const game_state& y)
+ const;
+ };
private:
- static game_state init_gs;
-
std::unordered_set<
- std::vector<pile>,
- boost::hash<std::vector<pile>>
+ game_state,
+ boost::hash<game_state>,
+ game_state_pred
> u_set;
};