aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/game/search-state/game_state.auto_foundation_moves.cpp1
-rw-r--r--src/main/game/search-state/game_state.h1
-rw-r--r--src/main/game/search-state/game_state.legal_moves.cpp29
-rw-r--r--src/main/input-output/input/sol_preset_types.cpp2
4 files changed, 7 insertions, 26 deletions
diff --git a/src/main/game/search-state/game_state.auto_foundation_moves.cpp b/src/main/game/search-state/game_state.auto_foundation_moves.cpp
index e0eaf00..2faddd0 100644
--- a/src/main/game/search-state/game_state.auto_foundation_moves.cpp
+++ b/src/main/game/search-state/game_state.auto_foundation_moves.cpp
@@ -6,7 +6,6 @@
typedef sol_rules::build_policy pol;
-typedef sol_rules::stock_deal_type sdt;
using std::max;
diff --git a/src/main/game/search-state/game_state.h b/src/main/game/search-state/game_state.h
index c46f25b..3c6b192 100644
--- a/src/main/game/search-state/game_state.h
+++ b/src/main/game/search-state/game_state.h
@@ -75,7 +75,6 @@ private:
void get_built_group_moves(std::vector<move>&) const;
pile::size_type get_built_group_height(pile::ref) const;
bool valid_built_group_move(card, card, card) const;
- void add_built_group_move(std::vector<move>&, pile::ref, pile::ref) const;
void add_empty_built_group_moves(std::vector<move>&, pile::ref, pile::ref,
card) const;
bool dominance_blocks_foundation_move(pile::ref);
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 85b9382..b6e110d 100644
--- a/src/main/game/search-state/game_state.legal_moves.cpp
+++ b/src/main/game/search-state/game_state.legal_moves.cpp
@@ -178,11 +178,7 @@ bool game_state::is_valid_tableau_move(const pile::ref rem_ref,
}
// Checks rank
- else if (rem_c.get_rank() + 1 != add_c.get_rank()) {
- return false;
- } else {
- return true;
- }
+ else return rem_c.get_rank() + 1 == add_c.get_rank();
}
bool game_state::is_valid_foundations_move(const pile::ref rem_ref,
@@ -253,7 +249,8 @@ void game_state::get_built_group_moves(vector<move>& moves) const {
// Adds the move to the list of moves, as a special built group move
if (valid_built_group_move(bg_low, bg_high, add_card)) {
- add_built_group_move(moves, rem_ref, add_ref);
+
+ moves.emplace_back(rem_ref, add_ref, built_group_height);
}
}
}
@@ -298,33 +295,19 @@ pile::size_type game_state::get_built_group_height(pile::ref ref) const {
bool game_state::valid_built_group_move(card bg_low, card bg_high, card add_card)
const {
- // The rank of the card we're moving the built group to must be greater than
- // the second-from-top card of the built group, and less than or equal to the
- // card that would come next at the top of the built pile
- if (add_card.get_rank() <= bg_low.get_rank() + 1
- || add_card.get_rank() > bg_high.get_rank() + 1) {
- return false;
- }
+ if (add_card.get_rank() != bg_high.get_rank() + 1) return false;
// Checks to see if the suits are correct
switch (rules.built_group_pol) {
case pol::SAME_SUIT:
return bg_low.get_suit() == add_card.get_suit();
-
case pol::RED_BLACK: {
- bool same_suit = bg_low.get_suit() == add_card.get_suit();
- bool even_diff = (add_card.get_rank() - bg_low.get_rank()) % 2 == 0;
- return (same_suit && even_diff) || (!same_suit && !even_diff);
+ return bg_high.get_colour() != add_card.get_colour();
}
default: return true;
}
}
-void game_state::add_built_group_move(vector<move>& moves, pile::ref rem_ref,
- pile::ref add_ref) const {
- moves.emplace_back(rem_ref, add_ref, 2);
-}
-
void game_state::add_empty_built_group_moves(vector<move>& moves,
pile::ref rem_ref,
pile::ref add_ref,
@@ -334,7 +317,7 @@ void game_state::add_empty_built_group_moves(vector<move>& moves,
pile::size_type card_idx = 1;
do {
moves.emplace_back(
- rem_ref, add_ref, static_cast<pile::ref>(card_idx + 1)
+ rem_ref, add_ref, static_cast<pile::size_type>(card_idx + 1)
);
} while (piles[rem_ref][card_idx++] != bg_high);
}
diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp
index 07c824b..53141a8 100644
--- a/src/main/input-output/input/sol_preset_types.cpp
+++ b/src/main/input-output/input/sol_preset_types.cpp
@@ -312,7 +312,7 @@ map<string, string> sol_preset_types::mp = {
"build policy": "same-suit",
"move built group": true
},
- "max rank": 5,
+ "max rank": 6,
"foundations initial card": true
}
)"