diff options
| author | Charlie Blake | 2017-11-13 09:52:23 +0000 |
|---|---|---|
| committer | GitHub | 2017-11-13 09:52:23 +0000 |
| commit | 96f9d446750e07c039ce5d482c92c464593c5bc9 (patch) | |
| tree | 5731e7eee2c041166479585daab804bc6d8e445c /src/main/game/pile.h | |
| parent | Merge pull request #19 from thecharlesblake/canfield (diff) | |
| parent | Refactor solver (diff) | |
| download | metasol-96f9d446750e07c039ce5d482c92c464593c5bc9.tar.gz metasol-96f9d446750e07c039ce5d482c92c464593c5bc9.zip | |
Merge pull request #20 from thecharlesblake/initial-code-cleanup
Initial code cleanup
Diffstat (limited to 'src/main/game/pile.h')
| -rw-r--r-- | src/main/game/pile.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/main/game/pile.h b/src/main/game/pile.h new file mode 100644 index 0000000..6482e0c --- /dev/null +++ b/src/main/game/pile.h @@ -0,0 +1,55 @@ +// +// Created by thecharlesblake on 10/28/17. +// + +#ifndef SOLVITAIRE_PILE_H +#define SOLVITAIRE_PILE_H + +#include <vector> + +#include "sol_rules.h" +#include "card.h" + +class pile { +public: + static pile foundation_factory(sol_rules::build_policy); + static pile cell_factory(); + static pile tableau_factory(sol_rules::build_order); + static pile reserve_factory(); + static pile stock_factory(); + static pile waste_factory(); + static pile hole_factory(int max_rank = 13); + + pile(bool, sol_rules::build_order, sol_rules::build_policy, bool, + int max_rank = 13); + + bool can_place(const card&) const; + bool can_remove() const; + card top_card() const; + bool empty() const; + unsigned long size() const; + sol_rules::build_order get_build_order() const; + + void place(const card&); + card take(); + void clear(); + + card& operator[] (std::vector<card>::size_type); + card operator[] (std::vector<card>::size_type) const; + + friend bool operator==(const pile&, const pile&); + +private: + bool one_lt(int, int) const; + + const bool remove; + const sol_rules::build_order build_order; + const sol_rules::build_policy build_policy; + const bool build_order_loops; + const int max_rank; + + std::vector<card> pile_vec; +}; + + +#endif //SOLVITAIRE_PILE_H |
