diff options
| author | thecharlesblake | 2017-11-06 15:35:10 +0000 |
|---|---|---|
| committer | thecharlesblake | 2017-11-06 15:35:10 +0000 |
| commit | f91cd251fd40d927254246e9276924af3e046dd1 (patch) | |
| tree | d67d93459276986d373a163aeeefa75e2b5c9920 /src/main/game_state.cpp | |
| parent | Add FC (reg & simple) to cmdln parsing & sol_rules (diff) | |
| download | metasol-f91cd251fd40d927254246e9276924af3e046dd1.tar.gz metasol-f91cd251fd40d927254246e9276924af3e046dd1.zip | |
Add cells to game state and next state generation
Diffstat (limited to 'src/main/game_state.cpp')
| -rw-r--r-- | src/main/game_state.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/main/game_state.cpp b/src/main/game_state.cpp index 29ccdc3..2dd1ca8 100644 --- a/src/main/game_state.cpp +++ b/src/main/game_state.cpp @@ -55,7 +55,7 @@ game_state::game_state(int seed, const sol_rules& s_rules) hole(false, ord::BOTH, pol::ANY_SUIT, true, rules.max_rank) { vector<card> deck = shuffled_deck(seed, rules.max_rank); - // If there is a hole, move the ace to spades to it + // If there is a hole, move the ace of spades to it if (rules.hole) { deck.erase(find(begin(deck), end(deck), card("AS"))); hole.place("AS"); @@ -82,6 +82,14 @@ game_state::game_state(int seed, const sol_rules& s_rules) foundations.push_back(p); } } + + // If there are cell piles, create the relevant cell vectors + if (rules.cells > 0) { + for (int i = 0; i < rules.cells; i++) { + pile p(true, ord::SINGLE_CARD, pol::ANY_SUIT, false); + foundations.push_back(p); + } + } } // Generate a randomly ordered vector of cards @@ -129,6 +137,10 @@ vector<game_state> game_state::get_next_legal_states() { can_add.push_back(&foundations[i]); } } + for (vector<pile>::size_type i = 0; i < cells.size(); i++) { + can_remove.push_back(&cells[i]); + can_add.push_back(&cells[i]); + } if (rules.hole) { can_add.push_back(&hole); } |
