From 1401b0cfa53e1b1f550a2128a9d72afb52575435 Mon Sep 17 00:00:00 2001 From: Charlie Blake Date: Thu, 14 Jun 2018 10:55:55 +0100 Subject: Simplify solvability script and make atomic --- src/main/input-output/input/command_line_helper.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/main/input-output/input/command_line_helper.cpp') diff --git a/src/main/input-output/input/command_line_helper.cpp b/src/main/input-output/input/command_line_helper.cpp index e88f434..0f685cb 100644 --- a/src/main/input-output/input/command_line_helper.cpp +++ b/src/main/input-output/input/command_line_helper.cpp @@ -40,8 +40,8 @@ command_line_helper::command_line_helper() "classification") ("cache-capacity", po::value(), "sets an upper bound on the number of states allowed in " "the cache") - ("solvability", "calculates the solvability " - "percentage of the supplied solitaire game. Must supply " + ("solvability", po::value(), "calculates the solvability " + "percentage of the supplied solitaire game, given a timeout in milliseconds. Must supply " "either 'random', 'benchmark', 'solvability' or list of deals to be " "solved.") ("benchmark", "outputs performance statistics for the solver on the " @@ -110,7 +110,11 @@ bool command_line_helper::parse(int argc, const char* argv[]) { cache_capacity = 100000000; // One hundred-million } - solvability = (vm.count("solvability") != 0); + if (vm.count("solvability")) { + solvability = vm["solvability"].as(); + } else { + solvability = -1; + } benchmark = (vm.count("benchmark") != 0); @@ -128,7 +132,7 @@ bool command_line_helper::assess_errors() { // The user must either supply input files, a random seed, or ask for the // solvability percentage, or benchmark - int opt_count = (random_deal != -1) + !input_files.empty() + solvability + benchmark; + int opt_count = (random_deal != -1) + !input_files.empty() + (solvability > 0) + benchmark; if (opt_count > 1) { print_too_many_opts_error(); @@ -211,7 +215,7 @@ uint64_t command_line_helper::get_cache_capacity() { return cache_capacity; } -bool command_line_helper::get_solvability() { +int command_line_helper::get_solvability() { return solvability; } -- cgit v1.2.1