diff options
| author | thecharlesblake | 2018-02-05 15:58:09 +0000 |
|---|---|---|
| committer | thecharlesblake | 2018-02-14 16:59:07 +0000 |
| commit | 8dba2d3a176d1381cf9c3ed31192c31a468608f1 (patch) | |
| tree | d81a2640ef10ff7725859d9e3dafa769743b0348 | |
| parent | Add foundations removable rule parsing (diff) | |
| download | metasol-8dba2d3a176d1381cf9c3ed31192c31a468608f1.tar.gz metasol-8dba2d3a176d1381cf9c3ed31192c31a468608f1.zip | |
Add removable foundations logic to legal moves gen
| -rw-r--r-- | src/main/game/game_state.legal_moves.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/game/game_state.legal_moves.cpp b/src/main/game/game_state.legal_moves.cpp index 3043587..fb08abb 100644 --- a/src/main/game/game_state.legal_moves.cpp +++ b/src/main/game/game_state.legal_moves.cpp @@ -24,6 +24,14 @@ vector<game_state::move> game_state::get_legal_moves() const { // Never removes a card from the hole, the waste, or an empty pile if (rem_ref == hole || piles[rem_ref].empty()) continue; + // If the foundations aren't removable, also skip them + if (rules.foundations + && !rules.foundations_removable + && rem_ref >= foundations.front() + && rem_ref <= foundations.back()) { + continue; + } + // Stock cards can only be moved to the waste (assuming there is a waste) if (rules.stock_size > 0 && rem_ref == stock) { if (rules.stock_deal_t == sdt::WASTE) { |
