aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/search-state/game_state.cpp
diff options
context:
space:
mode:
authorCharlie Blake2018-07-14 22:08:10 +0100
committerCharlie Blake2018-07-14 22:08:10 +0100
commit506a17e822c0364cf440b3d8eb22dad0038ea1ca (patch)
treec262537de30ec588614b1cfec8787615b84d51e6 /src/main/game/search-state/game_state.cpp
parentAdd rules fields for accordion (diff)
downloadmetasol-506a17e822c0364cf440b3d8eb22dad0038ea1ca.tar.gz
metasol-506a17e822c0364cf440b3d8eb22dad0038ea1ca.zip

Add random gen and state print for accordion

Diffstat (limited to 'src/main/game/search-state/game_state.cpp')
-rw-r--r--src/main/game/search-state/game_state.cpp17
1 files changed, 17 insertions, 0 deletions
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<pile::ref>(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;