diff options
| -rw-r--r-- | src/main/game/search-state/game_state.legal_moves.cpp | 3 | ||||
| -rw-r--r-- | src/main/game/sol_rules.h | 1 | ||||
| -rw-r--r-- | src/main/input-output/input/json-parsing/rules_parser.cpp | 11 | ||||
| -rw-r--r-- | src/main/input-output/input/sol_preset_types.cpp | 27 |
4 files changed, 39 insertions, 3 deletions
diff --git a/src/main/game/search-state/game_state.legal_moves.cpp b/src/main/game/search-state/game_state.legal_moves.cpp index b4ed810..76407d1 100644 --- a/src/main/game/search-state/game_state.legal_moves.cpp +++ b/src/main/game/search-state/game_state.legal_moves.cpp @@ -510,8 +510,9 @@ void game_state::add_sequence_moves(std::vector<move>& moves) const { if (rules.sequence_direction == dir::LEFT || rules.sequence_direction == dir::BOTH) { // Only twos in the far left column if (space_loc.second == piles[sequences[i]].size() - 1) { - if (from_card.get_rank() == 2) + if (from_card.get_rank() == 2) { moves.emplace_back(move::mtype::sequence, from_idx, space_idx); + } } // Otherwise must agree with left neighbour else { diff --git a/src/main/game/sol_rules.h b/src/main/game/sol_rules.h index 2384b21..5e2dd40 100644 --- a/src/main/game/sol_rules.h +++ b/src/main/game/sol_rules.h @@ -84,6 +84,7 @@ struct sol_rules { uint8_t sequence_count; direction sequence_direction; build_policy sequence_build_pol; + bool sequence_fixed_suit; uint8_t accordion_size; std::vector<std::pair<direction, uint8_t>> accordion_moves; std::vector<accordion_policy> accordion_pol; diff --git a/src/main/input-output/input/json-parsing/rules_parser.cpp b/src/main/input-output/input/json-parsing/rules_parser.cpp index 209153f..a7c4fae 100644 --- a/src/main/input-output/input/json-parsing/rules_parser.cpp +++ b/src/main/input-output/input/json-parsing/rules_parser.cpp @@ -445,6 +445,14 @@ void rules_parser::modify_sol_rules(sol_rules& sr, Document& d) { } } + if (d["sequences"].HasMember("fixed suit")) { + if (d["sequences"]["fixed suit"].IsBool()) { + sr.sequence_fixed_suit = d["sequences"]["fixed suit"].GetBool(); + } else { + json_helper::json_parse_err("[fixed suit] must be a boolean"); + } + } + if (d["sequences"].HasMember("direction")) { if (d["sequences"]["direction"].IsString()) { string dir_str = d["sequences"]["direction"].GetString(); @@ -689,6 +697,9 @@ string rules_parser::rules_schema_json() { "LR" ] }, + "fixed suit": { + "type": "boolean" + }, "build policy": { "type": "string", "enum": [ diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp index ee2485c..9ddf933 100644 --- a/src/main/input-output/input/sol_preset_types.cpp +++ b/src/main/input-output/input/sol_preset_types.cpp @@ -57,7 +57,8 @@ map<string, string> sol_preset_types::mp = { "sequences": { "count": 0, "direction": "L", - "build policy": "same-suit" + "build policy": "same-suit", + "fixed suit": false }, "max rank": 13, "two decks": false @@ -1083,7 +1084,29 @@ map<string, string> sol_preset_types::mp = { "sequences": { "count": 4, "direction": "L", - "build policy": "same-suit" + "build policy": "same-suit", + "fixed suit": false + } +} +)" + + }, + { + "gaps-basic-variant", + + R"( +{ + "foundations": { + "present": false + }, + "tableau piles": { + "count": 0 + }, + "sequences": { + "count": 4, + "direction": "L", + "build policy": "same-suit", + "fixed suit": true } } )" |
