diff options
| author | Tom Harley | 2018-11-16 11:09:45 +0000 |
|---|---|---|
| committer | Tom Harley | 2018-11-16 11:09:45 +0000 |
| commit | 8c819b9e127d6ca837da214667945634725a66ed (patch) | |
| tree | 1a0776ccc38b8c97b10fbefa8e10e93396d596d8 /src/main/game | |
| parent | changes in Makefile to turn off some warnings (diff) | |
| download | metasol-8c819b9e127d6ca837da214667945634725a66ed.tar.gz metasol-8c819b9e127d6ca837da214667945634725a66ed.zip | |
wow a thing that works
Diffstat (limited to 'src/main/game')
| -rw-r--r-- | src/main/game/search-state/game_state.cpp | 22 | ||||
| -rw-r--r-- | src/main/game/search-state/game_state.h | 2 |
2 files changed, 24 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) { diff --git a/src/main/game/search-state/game_state.h b/src/main/game/search-state/game_state.h index 512652f..9f8e3b9 100644 --- a/src/main/game/search-state/game_state.h +++ b/src/main/game/search-state/game_state.h @@ -39,6 +39,8 @@ public: game_state(const sol_rules&, int seed, streamliner_options); // Does the same but with an initialiser list (useful for testing) game_state(const sol_rules&, std::initializer_list<std::initializer_list<std::string>>); + // Does the same but with vectors + game_state(const sol_rules&, std::vector<std::vector<std::string>>); /* Altering state */ |
