aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/search-state/game_state.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/game/search-state/game_state.cpp')
-rw-r--r--src/main/game/search-state/game_state.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/game/search-state/game_state.cpp b/src/main/game/search-state/game_state.cpp
index 6cd1262..a547f7e 100644
--- a/src/main/game/search-state/game_state.cpp
+++ b/src/main/game/search-state/game_state.cpp
@@ -284,6 +284,28 @@ game_state::game_state(const sol_rules& s_rules,
}
}
+game_state::game_state(const sol_rules& s_rules,
+ std::vector<std::vector<string>> vec)
+ : game_state(s_rules, sos::NONE) {pile::ref pr = 0;
+ for (auto& p_vec : vec) {
+ for (const string& card_str : p_vec) {
+ card c(card_str.c_str(), s_rules.face_up == fu::TOP_CARDS);
+ place_card(pr, c);
+ }
+ pr++;
+ }
+
+ // Sets foundations base appropriately
+ if (rules.foundations_present && rules.foundations_base == boost::none) {
+ for (auto f : foundations) {
+ if (!piles[f].empty()) {
+ foundations_base = piles[f].top_card().get_rank();
+ return;
+ }
+ }
+ }
+}
+
// Generates a randomly ordered vector of cards
vector<card> game_state::gen_shuffled_deck(card::rank_t max_rank,
bool two_decks, mt19937 rng) {