diff options
| author | Charlie Blake | 2018-07-06 11:14:04 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-07-06 11:14:04 +0100 |
| commit | b044ca495c6214250628fc984863eb45c5d60852 (patch) | |
| tree | 5e83e80530232b518904c8980dab2979e7fec87e /src/main/game/search-state/game_state.legal_moves.cpp | |
| parent | Fix unit test compile bug (diff) | |
| download | metasol-b044ca495c6214250628fc984863eb45c5d60852.tar.gz metasol-b044ca495c6214250628fc984863eb45c5d60852.zip | |
Refactored game rules JSON
Diffstat (limited to 'src/main/game/search-state/game_state.legal_moves.cpp')
| -rw-r--r-- | src/main/game/search-state/game_state.legal_moves.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main/game/search-state/game_state.legal_moves.cpp b/src/main/game/search-state/game_state.legal_moves.cpp index 7dd75d8..f68df0b 100644 --- a/src/main/game/search-state/game_state.legal_moves.cpp +++ b/src/main/game/search-state/game_state.legal_moves.cpp @@ -119,7 +119,7 @@ vector<move> game_state::get_legal_moves(move parent_move) { } // Tableau / cells / reserve / stock-waste to hole / foundation moves - if (rules.hole || (rules.foundations && !rules.foundations_comp_piles)) { + if (rules.hole || (rules.foundations_present && !rules.foundations_only_comp_piles)) { // Stock if (rules.stock_size > 0 && rules.stock_deal_t == sdt::WASTE && !piles[stock].empty()) add_stock_to_hole_foundation_moves(moves); @@ -139,7 +139,7 @@ vector<move> game_state::get_legal_moves(move parent_move) { } } - if (rules.foundations_comp_piles) // i.e. Spider-type winning condition + if (rules.foundations_only_comp_piles) // i.e. Spider-type winning condition add_foundation_complete_piles_moves(moves); if (rules.tableau_pile_count > 0 && rules.face_up != fu::ALL) @@ -190,6 +190,7 @@ set<pile::size_type> game_state::generate_stock_moves_to_check() const { for (auto i = piles[stock].size() - 1 + rules.stock_deal_count; i < piles[stock].size() + stock_waste_sz - 1; i += rules.stock_deal_count) { + if (i == stock_waste_sz - 1) continue; // No need to add top of waste card as it is a regular move stock_moves_to_check.insert(static_cast<pile::size_type>(i % stock_waste_sz)); } } @@ -308,7 +309,7 @@ bool game_state::is_next_tableau_card(card a, card b) const { bool game_state::is_valid_foundations_move(const pile::ref rem_ref, const pile::ref add_ref) const { - if (rem_ref == add_ref || rules.foundations_comp_piles) return false; + if (rem_ref == add_ref || rules.foundations_only_comp_piles) return false; return is_valid_foundations_move(piles[rem_ref].top_card(), add_ref); } |
