aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/game_state.h
diff options
context:
space:
mode:
authorCharlie Blake2018-02-15 12:48:35 +0000
committerGitHub2018-02-15 12:48:35 +0000
commit9e865ef56ff2b90695343e2e5b7be6e05b2c56f4 (patch)
tree7cd620ee74084d74d849b44fae2db3897763cadb /src/main/game/game_state.h
parentMerge pull request #37 from thecharlesblake/docs (diff)
parentAdd simple auto-found + works w/ removable founds (diff)
downloadmetasol-9e865ef56ff2b90695343e2e5b7be6e05b2c56f4.tar.gz
metasol-9e865ef56ff2b90695343e2e5b7be6e05b2c56f4.zip

Merge pull request #38 from thecharlesblake/foundation-dominance

Foundation dominance

Diffstat (limited to 'src/main/game/game_state.h')
-rw-r--r--src/main/game/game_state.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h
index 9b0d7b5..b403bc7 100644
--- a/src/main/game/game_state.h
+++ b/src/main/game/game_state.h
@@ -11,6 +11,7 @@
#include <rapidjson/document.h>
#include <boost/functional/hash.hpp>
+#include <boost/optional/optional.hpp>
#include "card.h"
#include "pile.h"
@@ -28,6 +29,9 @@ public:
typedef uint8_t pile_ref;
struct move {
move(pile_ref, pile_ref, pile::size_type = 1);
+ bool is_dominance() const;
+
+ const static pile::size_type dominance_flag;
pile_ref from; pile_ref to; pile::size_type count;
};
@@ -45,10 +49,12 @@ public:
void place_card(pile_ref, card);
card take_card(pile_ref);
- std::vector<move> get_legal_moves() const;
+ std::vector<move> get_legal_moves();
// Inspects state
bool is_solved() const;
+ const std::vector<pile>& get_data() const;
+ boost::optional<move> get_dominance_move() const;
friend std::ostream& operator<< (std::ostream&, const game_state&);
@@ -73,6 +79,10 @@ private:
void add_built_group_move(std::vector<move>&, pile_ref, pile_ref) const;
void add_empty_built_group_moves(std::vector<move>&, pile_ref, pile_ref,
card) const;
+ bool dominance_blocks_foundation_move(pile_ref);
+
+ void update_auto_foundation_moves(pile_ref);
+ bool is_valid_auto_foundation_move(pile_ref) const;
// References to piles
const sol_rules rules;
@@ -90,6 +100,8 @@ private:
std::vector<pile_ref> original_cells;
std::vector<pile_ref> original_reserve;
+ std::vector<bool> auto_foundation_moves;
+
// The core piles
std::vector<pile> piles;
};