aboutsummaryrefslogtreecommitdiff
path: root/src/main/game_state.h
diff options
context:
space:
mode:
authorCharlie Blake2017-10-28 13:28:49 +0100
committerGitHub2017-10-28 13:28:49 +0100
commit7b05ae6f24856a207f9d9ab3218f1b5e75343d74 (patch)
tree4c7b3d779f29f5cef8a5eb1803441f1aa20ac0bd /src/main/game_state.h
parentMerge pull request #13 from thecharlesblake/docs (diff)
parentAdd RapidJSON to travis (diff)
downloadmetasol-7b05ae6f24856a207f9d9ab3218f1b5e75343d74.tar.gz
metasol-7b05ae6f24856a207f9d9ab3218f1b5e75343d74.zip

Merge pull request #14 from thecharlesblake/simple-black-hole

Simple black hole

Diffstat (limited to 'src/main/game_state.h')
-rw-r--r--src/main/game_state.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/main/game_state.h b/src/main/game_state.h
new file mode 100644
index 0000000..ff92247
--- /dev/null
+++ b/src/main/game_state.h
@@ -0,0 +1,38 @@
+//
+// Created by thecharlesblake on 10/24/17.
+//
+
+#ifndef SOLVITAIRE_GAME_STATE_H
+#define SOLVITAIRE_GAME_STATE_H
+
+#include <vector>
+#include <ostream>
+#include <string>
+
+#include <rapidjson/document.h>
+
+#include "card.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;
+ bool is_solved() const;
+ std::ostream& print(std::ostream&) const;
+
+ 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;
+};
+
+
+#endif //SOLVITAIRE_GAME_STATE_H