diff options
| author | thecharlesblake | 2018-01-18 13:51:09 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-01-18 13:51:09 +0000 |
| commit | 91442e15dd15f8a4db7455f52255bd46273b0a40 (patch) | |
| tree | b2e1374c28dde347f05a107771d76c923c2c8bee /src/main/game/game_state.h | |
| parent | Update legal moves code to use new suit rep. (diff) | |
| download | metasol-91442e15dd15f8a4db7455f52255bd46273b0a40.tar.gz metasol-91442e15dd15f8a4db7455f52255bd46273b0a40.zip | |
Update game state with static pile refs & rules
Diffstat (limited to 'src/main/game/game_state.h')
| -rw-r--r-- | src/main/game/game_state.h | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h index 8a41398..d8e35f3 100644 --- a/src/main/game/game_state.h +++ b/src/main/game/game_state.h @@ -15,12 +15,13 @@ #include "pile.h" #include "sol_rules.h" -class deal_parser; +//class deal_parser; -class game_state { - friend class deal_parser; +// TODO make class +struct game_state { + //friend class deal_parser; friend class state_printer; -public: +//public: // Defines types typedef uint8_t pile_ref; struct move { @@ -34,6 +35,9 @@ public: // Does the same from a 'rules' object game_state(const sol_rules&, int seed); + // For testing + game_state(std::initializer_list<pile>); + // Alters state void make_move(move); void undo_move(move); @@ -44,13 +48,13 @@ public: bool is_solved() const; const std::vector<pile>& get_data() const; - friend bool operator==(const game_state&, const game_state&); friend std::ostream& operator<< (std::ostream&, const game_state&); friend std::size_t hash_value(card const&); - friend std::size_t hash_value(std::vector<pile> 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); // Private constructor @@ -69,18 +73,17 @@ private: card) const; // References to piles - sol_rules rules; - std::vector<pile_ref> tableau_piles; - std::vector<pile_ref> cells; - pile_ref stock; - pile_ref waste; - std::vector<pile_ref> reserve; - std::vector<pile_ref> foundations; - pile_ref hole; + static sol_rules rules; + static std::vector<pile_ref> tableau_piles; + static std::vector<pile_ref> cells; + static pile_ref stock; + static pile_ref waste; + static std::vector<pile_ref> reserve; + static std::vector<pile_ref> foundations; + static pile_ref hole; // The core piles std::vector<pile> piles; }; - #endif //SOLVITAIRE_GAME_STATE_H |
