diff options
| author | Charlie Blake | 2018-01-09 08:58:30 +0000 |
|---|---|---|
| committer | GitHub | 2018-01-09 08:58:30 +0000 |
| commit | 93bfbeec309b027331f75d10864c99f19a958cfd (patch) | |
| tree | 5ad08a4621dbc118480553d53666e3e507ce584e /src/main/game/pile.h | |
| parent | Merge pull request #27 from thecharlesblake/efficient-implementation (diff) | |
| parent | Add spider to benchmark script (diff) | |
| download | metasol-93bfbeec309b027331f75d10864c99f19a958cfd.tar.gz metasol-93bfbeec309b027331f75d10864c99f19a958cfd.zip | |
Merge pull request #28 from thecharlesblake/all-canonical-games
All canonical games
Diffstat (limited to 'src/main/game/pile.h')
| -rw-r--r-- | src/main/game/pile.h | 41 |
1 files changed, 7 insertions, 34 deletions
diff --git a/src/main/game/pile.h b/src/main/game/pile.h index 978e32e..f2600fe 100644 --- a/src/main/game/pile.h +++ b/src/main/game/pile.h @@ -6,58 +6,31 @@ #define SOLVITAIRE_PILE_H #include <vector> +#include <iterator> #include "sol_rules.h" #include "card.h" class pile { public: - // Factory methods - static pile tableau_factory(sol_rules::build_order, sol_rules::build_policy); - static pile cell_factory(); - static pile reserve_factory(); - static pile stock_factory(); - static pile waste_factory(); - static pile foundation_factory(sol_rules::build_policy); - static pile hole_factory(int); - - // Constructors - pile(sol_rules::build_order bo = sol_rules::build_order::DESCENDING, - sol_rules::build_policy bp = sol_rules::build_policy::ANY_SUIT, - bool removable = true, - bool loops = false, - int max_rank = 13); + typedef uint8_t size_type; // Inspect - bool can_place(const card) const; - bool can_remove() const; card top_card() const; bool empty() const; - uint8_t size() const; - sol_rules::build_order get_build_order() const; + size_type size() const; // Modify - void place(const card); + void place(card); card take(); - void clear(); - // Index like array - card& operator[] (std::vector<card>::size_type); - card operator[] (std::vector<card>::size_type) const; + // Indexes the vector, with the top card as index 0 + card& operator[] (size_type); + card operator[] (size_type) const; friend bool operator==(const pile&, const pile&); friend std::size_t hash_value(pile const&); - private: - bool one_lt(int, int) const; - - // const pile properties - const sol_rules::build_order build_order; - const sol_rules::build_policy build_policy; - const bool removable; - const bool build_order_loops; - const int max_rank; - // Underlying vector std::vector<card> pile_vec; }; |
