From 48517141b32123f847dcb8d88e0dac999b9142ba Mon Sep 17 00:00:00 2001 From: thecharlesblake Date: Sun, 16 Sep 2018 21:27:36 +0100 Subject: Add parsing logic for sequence fixed suit rule --- .../input/json-parsing/rules_parser.cpp | 11 +++++++++ src/main/input-output/input/sol_preset_types.cpp | 27 ++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) (limited to 'src/main/input-output/input') 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 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 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 } } )" -- cgit v1.2.1