aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthecharlesblake2018-02-05 15:58:09 +0000
committerthecharlesblake2018-02-14 16:59:07 +0000
commit8dba2d3a176d1381cf9c3ed31192c31a468608f1 (patch)
treed81a2640ef10ff7725859d9e3dafa769743b0348 /src
parentAdd foundations removable rule parsing (diff)
downloadmetasol-8dba2d3a176d1381cf9c3ed31192c31a468608f1.tar.gz
metasol-8dba2d3a176d1381cf9c3ed31192c31a468608f1.zip

Add removable foundations logic to legal moves gen

Diffstat (limited to 'src')
-rw-r--r--src/main/game/game_state.legal_moves.cpp8
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) {