From 70522b28586ba117ff9e1e27c8f4b183f8414fd1 Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Sat, 28 Oct 2017 10:13:13 +0100 Subject: Add simple and regular bh types --- src/main/game_state.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/main/game_state.cpp') diff --git a/src/main/game_state.cpp b/src/main/game_state.cpp index 527f080..ef9db97 100644 --- a/src/main/game_state.cpp +++ b/src/main/game_state.cpp @@ -16,7 +16,10 @@ using namespace rapidjson; using namespace std; // Construct an initial game state from a JSON doc -game_state::game_state(const Document& doc) : max_rank(1) { +game_state::game_state(const Document& doc, string sol_type) + : max_rank(1) { + simple = sol_type == "simple-black-hole"; + // Construct tableau piles assert(doc.HasMember("tableau piles")); const Value& json_tab_piles = doc["tableau piles"]; @@ -42,7 +45,10 @@ game_state::game_state(const Document& doc) : max_rank(1) { } // Construct an initial game state from a seed -game_state::game_state(int seed) : max_rank(7) { +game_state::game_state(int seed, string sol_type) { + simple = sol_type == "simple-black-hole"; + max_rank = simple ? 7 : 13; + int start = 1; // Ignore the first (hole) card int end = max_rank * 4; @@ -51,7 +57,7 @@ game_state::game_state(int seed) : max_rank(7) { for (int i = start; i < end; i++) { v.push_back(new int(i)); } - + // Randomly shuffle the pointers auto rng = std::default_random_engine(seed); std::shuffle(std::begin(v), std::end(v), rng); -- cgit v1.2.1