diff options
| author | thecharlesblake | 2018-03-08 23:10:13 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-03-08 23:10:13 +0000 |
| commit | 5c3c87911b8149fedbc934fc2c98e6a331eeb4c3 (patch) | |
| tree | 99283bac863f3f69daeffd5db2b10282ff933f37 /src/main/game/game_state.legal_moves.cpp | |
| parent | Update JSON options for new spider rules (diff) | |
| download | metasol-5c3c87911b8149fedbc934fc2c98e6a331eeb4c3.tar.gz metasol-5c3c87911b8149fedbc934fc2c98e6a331eeb4c3.zip | |
Add stock deal when no empty tableau piles logic
Diffstat (limited to 'src/main/game/game_state.legal_moves.cpp')
| -rw-r--r-- | src/main/game/game_state.legal_moves.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/main/game/game_state.legal_moves.cpp b/src/main/game/game_state.legal_moves.cpp index 99431e3..1d9b94f 100644 --- a/src/main/game/game_state.legal_moves.cpp +++ b/src/main/game/game_state.legal_moves.cpp @@ -21,9 +21,19 @@ vector<game_state::move> game_state::get_legal_moves( // The next legal moves vector<move> moves; - // If we have a stock that can deal to the tableau piles, add this move + // If we have a stock that can deal to the tableau piles, adds this move if (rules.stock_deal_t == sdt::TABLEAU_PILES && !piles[stock].empty()) { - moves.emplace_back(get_stock_tableau_move()); + // Only does this if all the tableau piles are empty + bool no_tableau_empty = true; + for (auto tab_ref : tableau_piles) { + if (piles[tab_ref].empty()) { + no_tableau_empty = false; + break; + } + } + if (no_tableau_empty) { + moves.emplace_back(get_stock_tableau_move()); + } } // Cycles through each pile which we may be able to remove a card from |
