diff options
| author | thecharlesblake | 2018-01-18 18:57:58 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-18 18:57:58 +0000 |
| commit | 60b86edcba4cd61a0b14aa5e1138a1dd1d7d8718 (patch) | |
| tree | a330b3155b61b34544efde72c7d84e30f2221c01 /src | |
| parent | Update benchmark script to work when it reaches 13 (diff) | |
| download | metasol-60b86edcba4cd61a0b14aa5e1138a1dd1d7d8718.tar.gz metasol-60b86edcba4cd61a0b14aa5e1138a1dd1d7d8718.zip | |
Tidy up game_state private access
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/game/game_state.h | 12 | ||||
| -rw-r--r-- | src/main/game/global_cache.cpp | 4 | ||||
| -rw-r--r-- | src/main/game/global_cache.h | 12 |
3 files changed, 13 insertions, 15 deletions
diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h index d8e35f3..8dcffa4 100644 --- a/src/main/game/game_state.h +++ b/src/main/game/game_state.h @@ -15,13 +15,11 @@ #include "pile.h" #include "sol_rules.h" -//class deal_parser; - -// TODO make class -struct game_state { - //friend class deal_parser; +class game_state { + friend class deal_parser; friend class state_printer; -//public: + friend class game_state_pred; +public: // Defines types typedef uint8_t pile_ref; struct move { @@ -53,7 +51,7 @@ struct game_state { friend std::size_t hash_value(card const&); friend std::size_t hash_value(game_state const&); -//private: +private: void static_reset(); static std::vector<card> gen_shuffled_deck(int, card::rank_t, bool); diff --git a/src/main/game/global_cache.cpp b/src/main/game/global_cache.cpp index 83a9420..7be491e 100644 --- a/src/main/game/global_cache.cpp +++ b/src/main/game/global_cache.cpp @@ -86,7 +86,7 @@ size_t hash_value(game_state const& gs) { return seed; } -bool global_cache::game_state_pred::comp_pile(const pile &x, const pile &y) { +bool game_state_pred::comp_pile(const pile &x, const pile &y) { // Largest piles first if (x.size() != y.size()) { return x.size() > y.size(); @@ -105,7 +105,7 @@ bool global_cache::game_state_pred::comp_pile(const pile &x, const pile &y) { return false; } -bool global_cache::game_state_pred::operator()(const game_state& x, +bool game_state_pred::operator()(const game_state& x, const game_state& y) const { if (x.piles.size() != y.piles.size()) return false; diff --git a/src/main/game/global_cache.h b/src/main/game/global_cache.h index a3d1e48..486006c 100644 --- a/src/main/game/global_cache.h +++ b/src/main/game/global_cache.h @@ -13,17 +13,17 @@ #include "sol_rules.h" #include "game_state.h" +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; +}; + class global_cache { public: 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: std::unordered_set< game_state, |
