From 506a17e822c0364cf440b3d8eb22dad0038ea1ca Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Sat, 14 Jul 2018 22:08:10 +0100 Subject: Add random gen and state print for accordion --- src/main/game/search-state/game_state.cpp | 17 +++++++++++++++++ 1 file changed, 17 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 b61be3b..b1a8e5e 100644 --- a/src/main/game/search-state/game_state.cpp +++ b/src/main/game/search-state/game_state.cpp @@ -98,6 +98,15 @@ game_state::game_state(const sol_rules& s_rules, streamliner_options stream_opts } } + // If there is a reserve, creates piles + if (rules.accordion_size > 0) { + uint8_t pile_count = rules.accordion_size; + for (uint8_t i = 0; i < pile_count; i++) { + piles.emplace_back(); + accordion.push_back(static_cast(piles.size() - 1)); + } + } + // Creates the tableau piles for (uint8_t i = 0; i < rules.tableau_pile_count; i++) { piles.emplace_back(); @@ -173,6 +182,14 @@ game_state::game_state(const sol_rules& s_rules, int seed, streamliner_options s } } + // Deals to the accordion + if (rules.accordion_size > 0) { + for (unsigned int i = 0; i < rules.accordion_size; i++) { + place_card(accordion[i], deck.back()); + deck.pop_back(); + } + } + // This only occurs during testing if (rules.tableau_pile_count == 0) return; -- cgit v1.2.1