aboutsummaryrefslogtreecommitdiff
path: root/src/main/game_state.h
diff options
context:
space:
mode:
authorCharlie Blake2017-11-06 14:31:04 +0000
committerGitHub2017-11-06 14:31:04 +0000
commitd67ed718a0955c577cafc5716dc5ec5dc0129e9d (patch)
treef9c8a6578fcd73548a88ea8f06c2f22c8310cce8 /src/main/game_state.h
parentMerge pull request #14 from thecharlesblake/simple-black-hole (diff)
parentAdd counting of states searched (diff)
downloadmetasol-d67ed718a0955c577cafc5716dc5ec5dc0129e9d.tar.gz
metasol-d67ed718a0955c577cafc5716dc5ec5dc0129e9d.zip

Merge pull request #15 from thecharlesblake/spanish-patience

Spanish patience

Diffstat (limited to 'src/main/game_state.h')
-rw-r--r--src/main/game_state.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/main/game_state.h b/src/main/game_state.h
index ff92247..311c97f 100644
--- a/src/main/game_state.h
+++ b/src/main/game_state.h
@@ -12,26 +12,37 @@
#include <rapidjson/document.h>
#include "card.h"
+#include "sol_rules.h"
+#include "pile.h"
class game_state {
public:
- game_state(const rapidjson::Document&, std::string);
- game_state(int seed, std::string);
- std::vector<game_state> get_next_legal_states() const;
+ // Create a game state representation from a JSON doc
+ game_state(const rapidjson::Document&);
+ // Do the same from a 'rules' object
+ game_state(int seed, const sol_rules&);
+
+ std::vector<game_state> get_next_legal_states();
+ // NOTE: will only be evaluated after get_next_legal_states() is called
bool is_solved() const;
+
std::ostream& print(std::ostream&) const;
+ friend bool operator==(const game_state&, const game_state&);
friend std::ostream& operator<< (std::ostream&, const game_state&);
private:
- void move_to_hole(int);
- bool adjacent(const card& a, const card& b) const;
- bool simple;
-
- std::vector<std::vector<card> > tableau_piles;
- int max_rank;
- card hole_card;
- mutable bool solved;
+ static std::vector<card> shuffled_deck(int, int);
+
+ void print_header(std::ostream&, const char*) const;
+ void print_foundations(std::ostream&) const;
+ void print_tableau_piles(std::ostream&) const;
+ void print_hole(std::ostream&) const;
+
+ std::vector<pile> tableau_piles;
+ std::vector<pile> foundations;
+ sol_rules rules;
+ pile hole;
};