aboutsummaryrefslogtreecommitdiff
path: root/src/main/game/game_state.legal_moves.cpp
diff options
context:
space:
mode:
authorthecharlesblake2018-04-04 16:00:47 +0100
committerthecharlesblake2018-04-04 16:00:47 +0100
commitec02b3eaf85f222335463b3e2e6790f7e2691047 (patch)
tree2f6a6473993d6df448f16253950f03c9f5c5031b /src/main/game/game_state.legal_moves.cpp
parentAdd pile tests (diff)
downloadmetasol-ec02b3eaf85f222335463b3e2e6790f7e2691047.tar.gz
metasol-ec02b3eaf85f222335463b3e2e6790f7e2691047.zip

Add legal move gen tests and refactor

Diffstat (limited to 'src/main/game/game_state.legal_moves.cpp')
-rw-r--r--src/main/game/game_state.legal_moves.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/game/game_state.legal_moves.cpp b/src/main/game/game_state.legal_moves.cpp
index f0502d1..c137b07 100644
--- a/src/main/game/game_state.legal_moves.cpp
+++ b/src/main/game/game_state.legal_moves.cpp
@@ -22,8 +22,10 @@ vector<game_state::move> game_state::get_legal_moves(
vector<move> moves;
// 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()) {
- // Only does this if all the tableau piles are empty
+ if (rules.stock_size > 0
+ && rules.stock_deal_t == sdt::TABLEAU_PILES
+ && !piles[stock].empty()) {
+ // Only does this if none of the tableau piles are empty
bool no_tableau_empty = true;
for (auto tab_ref : tableau_piles) {
if (piles[tab_ref].empty()) {
@@ -394,3 +396,9 @@ bool game_state::dominance_blocks_foundation_move(pile_ref target_pile) {
return blocked;
}
+
+bool operator==(const game_state::move& a, const game_state::move& b) {
+ return (a.from == b.from )
+ && (a.to == b.to )
+ && (a.count == b.count);
+}