aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/sol_rules.h
diff options
context:
space:
mode:
authorthecharlesblake2018-01-03 12:30:14 +0000
committerthecharlesblake2018-01-03 12:30:14 +0000
commit77a7aeba7854d15b140cc6dc3c69b15ed5f3b936 (patch)
tree70b3b8315646ed38000a1627ec3f3efe20f31f92 /src/main/game/sol_rules.h
parentUpdate idea to python3 (diff)
downloadmetasol-77a7aeba7854d15b140cc6dc3c69b15ed5f3b936.tar.gz
metasol-77a7aeba7854d15b140cc6dc3c69b15ed5f3b936.zip

Major refactor, putting pile logic into game_state

Much of the logic that was in the pile class was beginning to seem out of place. A lot of the rules have fairly arbitrary interactons between piles, which weren’t best represented in the pile classes themselves, which were getting unweildy and inefficient. Hence, much of this logic has been moved to the game state class.

Diffstat (limited to 'src/main/game/sol_rules.h')
-rw-r--r--src/main/game/sol_rules.h32
1 files changed, 4 insertions, 28 deletions
diff --git a/src/main/game/sol_rules.h b/src/main/game/sol_rules.h
index 96c10d5..3d4995d 100644
--- a/src/main/game/sol_rules.h
+++ b/src/main/game/sol_rules.h
@@ -15,42 +15,22 @@
class sol_rules {
public:
- enum class valid_sol {
- BLACK_HOLE,
- SIMPLE_BLACK_HOLE,
- SPANISH_PATIENCE,
- SIMPLE_SPANISH_PATIENCE,
- FREE_CELL,
- SIMPLE_FREE_CELL,
- CANFIELD,
- SIMPLE_CANFIELD
- };
+ // Tableau policies
enum class build_order {
- NO_BUILD,
DESCENDING,
- ASCENDING,
- BOTH,
- SINGLE_CARD,
- ANY
+ ASCENDING
};
enum class build_policy {
- CLUBS,
- DIAMONDS,
- HEARTS,
- SPADES,
- ANY_SUIT,
+ NO_BUILD,
SAME_SUIT,
RED_BLACK,
- N_A
+ ANY_SUIT
};
enum class spaces_policy {
NO_BUILD,
ANY
};
- static bool is_suit(build_policy);
- static card::suit_t suit_val(build_policy);
-
static const sol_rules from_preset(std::string);
static const sol_rules from_file(std::string);
@@ -62,15 +42,11 @@ public:
bool hole;
bool foundations;
uint8_t cells;
- uint8_t reserve_size;
uint8_t stock_size;
private:
static sol_rules get_default();
static void modify_sol_rules(sol_rules&, rapidjson::Document&);
- static void parse_err(const std::string&);
-
- static valid_sol valid_sol_enum(const std::string&);
};
#endif //SOLVITAIRE_SOL_RULES_H