aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorthecharlesblake2017-11-07 10:44:06 +0000
committerthecharlesblake2017-11-11 11:07:35 +0000
commitdc01c77d6615d7b74bd3657142ea3e9604279a52 (patch)
tree18975a6679f203d105db6f73946e51b7cca391f7 /src
parentAmend random deal gen w/ stock,waste,reserve (diff)
downloadmetasol-dc01c77d6615d7b74bd3657142ea3e9604279a52.tar.gz
metasol-dc01c77d6615d7b74bd3657142ea3e9604279a52.zip

Add Canfield valid next state gen

Diffstat (limited to 'src')
-rw-r--r--src/main/game_state.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/game_state.cpp b/src/main/game_state.cpp
index 80f3cce..a783158 100644
--- a/src/main/game_state.cpp
+++ b/src/main/game_state.cpp
@@ -159,6 +159,9 @@ vector<game_state> game_state::get_next_legal_states() {
can_add.push_back(&tableau_piles[i]);
}
}
+ if (rules.reserve_size > 0) {
+ can_remove.push_back(&reserve);
+ }
if (rules.foundations) {
for (vector<pile>::size_type i = 0; i < foundations.size(); i++) {
can_remove.push_back(&foundations[i]);
@@ -176,6 +179,7 @@ vector<game_state> game_state::get_next_legal_states() {
// The next legal states
vector<game_state> next;
+ // Moving from and to the 'can remove' and 'can add' piles
for (pile *rem_pile : can_remove) {
if (rem_pile->empty()) continue;
@@ -191,6 +195,12 @@ vector<game_state> game_state::get_next_legal_states() {
}
}
+ // Dealing from the stock to the waste
+ move(&stock, &waste);
+ game_state s = *this;
+ next.push_back(s);
+ move(&waste, &stock);
+
return next;
}