diff options
| author | Charlie Blake | 2018-06-29 11:57:15 +0100 |
|---|---|---|
| committer | Charlie Blake | 2018-06-29 11:57:15 +0100 |
| commit | ccc77aecea3bf4b629780ee6441fff8f92de251a (patch) | |
| tree | 2bb6d836a13c29abcb9e6076394dc625361368c8 /src/main | |
| parent | Fix bugs + correct built pile kings. Cell + founds (diff) | |
| download | metasol-ccc77aecea3bf4b629780ee6441fff8f92de251a.tar.gz metasol-ccc77aecea3bf4b629780ee6441fff8f92de251a.zip | |
Fix built group reveal bug
Diffstat (limited to 'src/main')
| -rw-r--r-- | src/main/game/search-state/game_state.h | 2 | ||||
| -rw-r--r-- | src/main/game/search-state/game_state.legal_moves.cpp | 16 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/main/game/search-state/game_state.h b/src/main/game/search-state/game_state.h index f6f41d9..b63823d 100644 --- a/src/main/game/search-state/game_state.h +++ b/src/main/game/search-state/game_state.h @@ -106,7 +106,7 @@ private: pile::size_type get_built_group_height(pile::ref) const; void add_empty_built_group_moves(std::vector<move>&, pile::ref, pile::ref, - card) const; + card, bool) const; bool is_next_built_group_card(card, card) const; bool is_next_legal_card(sol_rules::build_policy, card, card) const; 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 cadeca9..be1d717 100644 --- a/src/main/game/search-state/game_state.legal_moves.cpp +++ b/src/main/game/search-state/game_state.legal_moves.cpp @@ -358,16 +358,17 @@ void game_state::add_built_group_moves(vector<move> &moves) const { card bg_high = piles[rem_ref][built_group_height - 1]; + bool is_reveal_move = + piles[rem_ref].size() > built_group_height + && piles[rem_ref][built_group_height].is_face_down(); + if (piles[add_ref].empty()) { if (rules.spaces_pol == s_pol::ANY) - add_empty_built_group_moves(moves, rem_ref, add_ref, bg_high); + add_empty_built_group_moves(moves, rem_ref, add_ref, bg_high, is_reveal_move); else if (rules.spaces_pol == s_pol::KINGS && bg_high.get_rank() == 13) - moves.emplace_back(move::mtype::built_group, rem_ref, add_ref, built_group_height); + moves.emplace_back(move::mtype::built_group, rem_ref, add_ref, built_group_height, is_reveal_move); } else { if (is_next_built_group_card(piles[add_ref].top_card(), bg_high)) { - bool is_reveal_move = - piles[rem_ref].size() > built_group_height - && piles[rem_ref][built_group_height].is_face_down(); moves.emplace_back(move::mtype::built_group, rem_ref, add_ref, built_group_height, is_reveal_move); } } @@ -387,10 +388,11 @@ pile::size_type game_state::get_built_group_height(pile::ref ref) const { // Loops through each possible built group move to an empty pile and adds it to the list void game_state::add_empty_built_group_moves(vector<move>& moves, pile::ref rem_ref, pile::ref add_ref, - card bg_high) const { + card bg_high, bool is_reveal_move) const { pile::size_type card_idx = 1; do { - moves.emplace_back(move::mtype::built_group, rem_ref, add_ref, static_cast<pile::size_type>(card_idx + 1)); + moves.emplace_back(move::mtype::built_group, rem_ref, add_ref, static_cast<pile::size_type>(card_idx + 1), + is_reveal_move); } while (piles[rem_ref][card_idx++] != bg_high); if (card_idx < piles[rem_ref].size() && piles[rem_ref][card_idx].is_face_down()) |
