diff options
| author | Charlie Blake | 2018-09-17 09:08:33 +0100 |
|---|---|---|
| committer | GitHub | 2018-09-17 09:08:33 +0100 |
| commit | 01918e2866d858c91c110736f763b4ac88403cb1 (patch) | |
| tree | cb00364efed78510be9751aab5038a415a75149a /src/main/game | |
| parent | Merge pull request #89 from thecharlesblake/add-gaps-basic (diff) | |
| parent | Change vbar csv to comma and add overall sol col (diff) | |
| download | metasol-01918e2866d858c91c110736f763b4ac88403cb1.tar.gz metasol-01918e2866d858c91c110736f763b4ac88403cb1.zip | |
Merge pull request #90 from thecharlesblake/correct-fortunes-favor
Correct fortunes favor
Diffstat (limited to 'src/main/game')
| -rw-r--r-- | src/main/game/search-state/game_state.dominance_moves.cpp | 20 | ||||
| -rw-r--r-- | src/main/game/search-state/game_state.h | 1 | ||||
| -rw-r--r-- | src/main/game/sol_rules.h | 3 |
3 files changed, 23 insertions, 1 deletions
diff --git a/src/main/game/search-state/game_state.dominance_moves.cpp b/src/main/game/search-state/game_state.dominance_moves.cpp index bc20cb5..d0b4b43 100644 --- a/src/main/game/search-state/game_state.dominance_moves.cpp +++ b/src/main/game/search-state/game_state.dominance_moves.cpp @@ -71,6 +71,9 @@ optional<move> game_state::get_dominance_move() const { if (rules.spaces_pol == s_pol::AUTO_RESERVE_THEN_WASTE) { optional<move> arm = auto_reserve_move(); if (arm) return arm; + } else if (rules.spaces_pol == s_pol::AUTO_WASTE_THEN_STOCK) { + optional<move> awsm = auto_waste_stock_move(); + if (awsm) return awsm; } // If there are 2 decks or no foundations, return @@ -124,6 +127,23 @@ optional<move> game_state::auto_reserve_move() const { return boost::none; } +optional<move> game_state::auto_waste_stock_move() const { + if (!piles[waste].empty()) { + for (auto to : tableau_piles) { + if (piles[to].empty()) { + return move(move::mtype::dominance, waste, to); + } + } + } else if (!piles[stock].empty()) { + for (auto to : tableau_piles) { + if (piles[to].empty()) { + return move(move::mtype::dominance, stock, to); + } + } + } + return boost::none; +} + bool game_state::is_ordered_pile(pile::ref pr) const { if (piles[pr].size() != rules.max_rank) return false; diff --git a/src/main/game/search-state/game_state.h b/src/main/game/search-state/game_state.h index 3df67ec..08391d6 100644 --- a/src/main/game/search-state/game_state.h +++ b/src/main/game/search-state/game_state.h @@ -132,6 +132,7 @@ private: /* Auto-foundation moves */ boost::optional<move> auto_reserve_move() const; + boost::optional<move> auto_waste_stock_move() const; bool is_valid_auto_foundation_move(pile::ref) const; bool is_ordered_pile(pile::ref) const; bool dominance_blocks_foundation_move(pile::ref); diff --git a/src/main/game/sol_rules.h b/src/main/game/sol_rules.h index 5e2dd40..642e4a6 100644 --- a/src/main/game/sol_rules.h +++ b/src/main/game/sol_rules.h @@ -26,7 +26,8 @@ struct sol_rules { NO_BUILD, KINGS, ANY, - AUTO_RESERVE_THEN_WASTE + AUTO_RESERVE_THEN_WASTE, + AUTO_WASTE_THEN_STOCK }; enum class accordion_policy { SAME_RANK, |
