aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/input
diff options
context:
space:
mode:
authorCharlie Blake2018-02-15 12:48:35 +0000
committerGitHub2018-02-15 12:48:35 +0000
commit9e865ef56ff2b90695343e2e5b7be6e05b2c56f4 (patch)
tree7cd620ee74084d74d849b44fae2db3897763cadb /src/main/input-output/input
parentMerge pull request #37 from thecharlesblake/docs (diff)
parentAdd simple auto-found + works w/ removable founds (diff)
downloadmetasol-9e865ef56ff2b90695343e2e5b7be6e05b2c56f4.tar.gz
metasol-9e865ef56ff2b90695343e2e5b7be6e05b2c56f4.zip

Merge pull request #38 from thecharlesblake/foundation-dominance

Foundation dominance

Diffstat (limited to 'src/main/input-output/input')
-rw-r--r--src/main/input-output/input/json-parsing/rules_parser.cpp8
-rw-r--r--src/main/input-output/input/sol_preset_types.cpp25
2 files changed, 25 insertions, 8 deletions
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 7b9de84..395f2e7 100644
--- a/src/main/input-output/input/json-parsing/rules_parser.cpp
+++ b/src/main/input-output/input/json-parsing/rules_parser.cpp
@@ -181,6 +181,14 @@ void rules_parser::modify_sol_rules(sol_rules& sr, Document& d) {
}
}
+ if (d.HasMember("foundations removable")) {
+ if (d["foundations removable"].IsBool()) {
+ sr.foundations_removable = d["foundations removable"].GetBool();
+ } else {
+ json_helper::json_parse_err("[foundations removable] must be a boolean");
+ }
+ }
+
if (d.HasMember("cells")) {
if (d["cells"].IsInt()) {
sr.cells = static_cast<uint8_t>(d["cells"].GetInt());
diff --git a/src/main/input-output/input/sol_preset_types.cpp b/src/main/input-output/input/sol_preset_types.cpp
index 8f0293f..de0fd41 100644
--- a/src/main/input-output/input/sol_preset_types.cpp
+++ b/src/main/input-output/input/sol_preset_types.cpp
@@ -32,6 +32,7 @@ std::map<string, string> sol_preset_types::mp = {
"hole": false,
"foundations": true,
"foundations initial card": false,
+ "foundations removable": false,
"cells": 0,
"stock size": 0,
"stock deal type": "waste",
@@ -48,7 +49,8 @@ std::map<string, string> sol_preset_types::mp = {
{
"tableau piles": {
"count": 13
- }
+ },
+ "foundations removable": true
}
)"
@@ -61,7 +63,8 @@ std::map<string, string> sol_preset_types::mp = {
"tableau piles": {
"count": 3
},
- "max rank": 2
+ "max rank": 2,
+ "foundations removable": true
}
)"
@@ -102,7 +105,8 @@ std::map<string, string> sol_preset_types::mp = {
"tableau piles": {
"count": 13,
"spaces policy": "no-build"
- }
+ },
+ "foundations removable": true
}
)"
@@ -116,7 +120,8 @@ std::map<string, string> sol_preset_types::mp = {
"count": 3,
"spaces policy": "no-build"
},
- "max rank": 3
+ "max rank": 3,
+ "foundations removable": true
}
)"
@@ -191,7 +196,8 @@ std::map<string, string> sol_preset_types::mp = {
"tableau piles": {
"count": 6
},
- "reserve size": 16
+ "reserve size": 16,
+ "foundations removable": true
}
)"
@@ -205,7 +211,8 @@ std::map<string, string> sol_preset_types::mp = {
"count": 3
},
"max rank": 3,
- "reserve size": 3
+ "reserve size": 3,
+ "foundations removable": true
}
)"
@@ -252,7 +259,8 @@ std::map<string, string> sol_preset_types::mp = {
"count": 10,
"build policy": "red-black",
"diagonal deal": true
- }
+ },
+ "foundations removable": true
}
)"
@@ -267,7 +275,8 @@ std::map<string, string> sol_preset_types::mp = {
"build policy": "red-black",
"diagonal deal": true
},
- "max rank": 2
+ "max rank": 2,
+ "foundations removable": true
}
)"