From 86ce38efc5ad3bf4fe06ef4c515591545e6fe925 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Wed, 14 Feb 2018 16:42:38 +0000 Subject: Update game rep to deal with foundation dominance --- src/main/game/game_state.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/main/game/game_state.h') diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h index 9b0d7b5..2b68e8c 100644 --- a/src/main/game/game_state.h +++ b/src/main/game/game_state.h @@ -11,6 +11,7 @@ #include #include +#include #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; }; @@ -49,6 +53,8 @@ public: // Inspects state bool is_solved() const; + const std::vector& get_data() const; + boost::optional get_dominance_move() const; friend std::ostream& operator<< (std::ostream&, const game_state&); @@ -74,6 +80,8 @@ private: void add_empty_built_group_moves(std::vector&, pile_ref, pile_ref, card) const; + void assess_auto_foundation_moves(pile_ref); + // References to piles const sol_rules rules; std::list tableau_piles; @@ -90,6 +98,8 @@ private: std::vector original_cells; std::vector original_reserve; + std::vector auto_foundation_moves; + // The core piles std::vector piles; }; -- cgit v1.2.1 From 496d7a23cdaa0616b1453d54afb34a9108190f67 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Thu, 15 Feb 2018 12:44:42 +0000 Subject: Add simple auto-found + works w/ removable founds --- src/main/game/game_state.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/game/game_state.h') diff --git a/src/main/game/game_state.h b/src/main/game/game_state.h index 2b68e8c..b403bc7 100644 --- a/src/main/game/game_state.h +++ b/src/main/game/game_state.h @@ -49,7 +49,7 @@ public: void place_card(pile_ref, card); card take_card(pile_ref); - std::vector get_legal_moves() const; + std::vector get_legal_moves(); // Inspects state bool is_solved() const; @@ -79,8 +79,10 @@ private: void add_built_group_move(std::vector&, pile_ref, pile_ref) const; void add_empty_built_group_moves(std::vector&, pile_ref, pile_ref, card) const; + bool dominance_blocks_foundation_move(pile_ref); - void assess_auto_foundation_moves(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; -- cgit v1.2.1