From dc01c77d6615d7b74bd3657142ea3e9604279a52 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Tue, 7 Nov 2017 10:44:06 +0000 Subject: Add Canfield valid next state gen --- src/main/game_state.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') 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::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::size_type i = 0; i < foundations.size(); i++) { can_remove.push_back(&foundations[i]); @@ -176,6 +179,7 @@ vector game_state::get_next_legal_states() { // The next legal states vector 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::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; } -- cgit v1.2.1