diff options
| author | Charlie Blake | 2018-04-07 11:27:06 +0100 |
|---|---|---|
| committer | GitHub | 2018-04-07 11:27:06 +0100 |
| commit | 1cc7640a3f35cc8905f0f4e21164c5a15dbe4cc0 (patch) | |
| tree | c1536ec34dcb159a747ba2a8a791c9f4bb3b9dfc | |
| parent | Merge pull request #53 from thecharlesblake/cmdln-rules-bugfix (diff) | |
| parent | Fix built group bug (diff) | |
| download | metasol-1cc7640a3f35cc8905f0f4e21164c5a15dbe4cc0.tar.gz metasol-1cc7640a3f35cc8905f0f4e21164c5a15dbe4cc0.zip | |
Merge pull request #54 from thecharlesblake/fix-built-group-bug
Fix built group bug
| -rw-r--r-- | optimisation-test.py | 11 | ||||
| -rw-r--r-- | src/main/input-output/input/json-parsing/rules_parser.cpp | 32 |
2 files changed, 22 insertions, 21 deletions
diff --git a/optimisation-test.py b/optimisation-test.py index 36dac55..173cfb0 100644 --- a/optimisation-test.py +++ b/optimisation-test.py @@ -1,15 +1,14 @@ import sys from subprocess import run, CalledProcessError, DEVNULL, PIPE, Popen -runCount = 100 +runCount = 500 # Loops through each canonical solitaire for optimisation in [ -# "-no-reduced-state", + "-no-reduced-state", "-no-pile-symmetry", - "-no-auto-foundations", - "-no-card-just-moved" + "-no-auto-foundations" ]: for preset in [ @@ -21,8 +20,8 @@ for optimisation in [ "simple-fortunes-favor", "simple-free-cell", "simple-somerset", - "simple-spanish-patience", - "simple-spider"]: + "simple-spanish-patience" + ]: differs = [] 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 02b2583..d4879de 100644 --- a/src/main/input-output/input/json-parsing/rules_parser.cpp +++ b/src/main/input-output/input/json-parsing/rules_parser.cpp @@ -128,26 +128,28 @@ void rules_parser::modify_sol_rules(sol_rules& sr, Document& d) { } } + string mbgp_str; if (d["tableau piles"].HasMember("move built group policy")) { if (d["tableau piles"]["move built group policy"].IsString()) { - string mbgp_str = d["tableau piles"]["move built group policy"].GetString(); - - if (mbgp_str == "same-as-build") { - sr.built_group_pol = sr.build_pol; - } else if (mbgp_str == "any-suit") { - sr.built_group_pol = pol::ANY_SUIT; - } else if (mbgp_str == "red-black") { - sr.built_group_pol = pol::RED_BLACK; - } else if (mbgp_str == "same-suit") { - sr.built_group_pol = pol::SAME_SUIT; - } else if (mbgp_str == "no-build") { - sr.built_group_pol = pol::NO_BUILD; - } else { - json_helper::json_parse_err("[tableau piles][move built group policy] is invalid"); - } + mbgp_str = d["tableau piles"]["move built group policy"].GetString(); } else { json_helper::json_parse_err("[tableau piles][move built group policy] must be a string"); } + } else { + mbgp_str = "same-as-build"; + } + if (mbgp_str == "same-as-build") { + sr.built_group_pol = sr.build_pol; + } else if (mbgp_str == "any-suit") { + sr.built_group_pol = pol::ANY_SUIT; + } else if (mbgp_str == "red-black") { + sr.built_group_pol = pol::RED_BLACK; + } else if (mbgp_str == "same-suit") { + sr.built_group_pol = pol::SAME_SUIT; + } else if (mbgp_str == "no-build") { + sr.built_group_pol = pol::NO_BUILD; + } else { + json_helper::json_parse_err("[tableau piles][move built group policy] is invalid"); } if (d["tableau piles"].HasMember("diagonal deal")) { |
