From 1ef39e9ba6ce1a622c53f38929d1e77b4f2518fc Mon Sep 17 00:00:00 2001 From: Tom Harley Date: Thu, 24 Jan 2019 12:10:15 +0000 Subject: It works with fortune's favor It seems to be consistently running to completion successfully! It's been renamed to `metasol` for now, since that's a better name than `test`. Next step will probably be eliminating the namespace pollution in `metasol.cpp`. --- src/main/game/search-state/game_state.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/main/game/search-state/game_state.cpp') diff --git a/src/main/game/search-state/game_state.cpp b/src/main/game/search-state/game_state.cpp index a547f7e..6ea550c 100644 --- a/src/main/game/search-state/game_state.cpp +++ b/src/main/game/search-state/game_state.cpp @@ -306,6 +306,36 @@ game_state::game_state(const sol_rules& s_rules, } } +game_state::game_state(const sol_rules& s_rules, + std::vector> suits, + std::vector> ranks, + std::vector> face_down) + : game_state(s_rules, sos::NONE) {pile::ref pr = 0; + assert(suits.size() == ranks.size()); + assert(ranks.size() == face_down.size()); + for (std::vector>::size_type i = 0; + i < suits.size(); ++i) { + assert(suits[i].size() == ranks[i].size()); + assert(ranks[i].size() == face_down[i].size()); + for (std::vector::size_type j = 0; j < suits[i].size(); + ++j) { + card c(suits[i][j], ranks[i][j], face_down[i][j]); + 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 game_state::gen_shuffled_deck(card::rank_t max_rank, bool two_decks, mt19937 rng) { -- cgit v1.2.1