aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/game_state.h
diff options
context:
space:
mode:
authorCharlie Blake2018-01-18 23:57:52 +0000
committerGitHub2018-01-18 23:57:52 +0000
commitbcaff64bdeaab93ff0d40dfd039b4b43ff689b1c (patch)
tree7882812349716607773458b1c830579de802793f /src/main/game/game_state.h
parentMerge pull request #29 from thecharlesblake/refactor-improve-debug (diff)
parentRemoves unnecessary assert statement bug (diff)
downloadmetasol-bcaff64bdeaab93ff0d40dfd039b4b43ff689b1c.tar.gz
metasol-bcaff64bdeaab93ff0d40dfd039b4b43ff689b1c.zip

Merge pull request #30 from thecharlesblake/symmetrical-hash

Symmetrical hash

Diffstat (limited to 'src/main/game/game_state.h')
-rw-r--r--src/main/game/game_state.h30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h
index 323646f..8dcffa4 100644
--- a/src/main/game/game_state.h
+++ b/src/main/game/game_state.h
@@ -15,11 +15,10 @@
#include "pile.h"
#include "sol_rules.h"
-class deal_parser;
-
class game_state {
friend class deal_parser;
friend class state_printer;
+ friend class game_state_pred;
public:
// Defines types
typedef uint8_t pile_ref;
@@ -34,6 +33,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,14 +46,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(game_state const&);
- friend std::size_t hash_value(std::vector<pile> const&);
-
- friend std::ostream& operator<< (std::ostream&, const game_state&);
private:
+ void static_reset();
static std::vector<card> gen_shuffled_deck(int, card::rank_t, bool);
// Private constructor
@@ -70,18 +71,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