diff options
| author | thecharlesblake | 2017-10-28 10:13:13 +0100 |
|---|---|---|
| committer | thecharlesblake | 2017-10-28 10:13:13 +0100 |
| commit | 70522b28586ba117ff9e1e27c8f4b183f8414fd1 (patch) | |
| tree | 7ab7edafbbec14406f876e2bca72b0eb69411b26 /src/main/game_state.cpp | |
| parent | Add random game generation to bh (diff) | |
| download | metasol-70522b28586ba117ff9e1e27c8f4b183f8414fd1.tar.gz metasol-70522b28586ba117ff9e1e27c8f4b183f8414fd1.zip | |
Add simple and regular bh types
Diffstat (limited to 'src/main/game_state.cpp')
| -rw-r--r-- | src/main/game_state.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
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); |
