aboutsummaryrefslogtreecommitdiff
path: root/src/main/input-output/input/command_line_helper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/input-output/input/command_line_helper.cpp')
-rw-r--r--src/main/input-output/input/command_line_helper.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main/input-output/input/command_line_helper.cpp b/src/main/input-output/input/command_line_helper.cpp
index 05cb86e..7853b55 100644
--- a/src/main/input-output/input/command_line_helper.cpp
+++ b/src/main/input-output/input/command_line_helper.cpp
@@ -30,6 +30,8 @@ command_line_helper::command_line_helper()
("random", po::value<int>(), "create and solve a random solitaire "
"deal based on a seed. Must supply either 'random',"
"'solvability' or list of deals to be solved.")
+ ("shortest-sols", "for each instance returns the shortest possible "
+ "solution. cannot be supplied alongside '--solvability'")
("solvability", "calculates the solvability "
"percentage of the supplied solitaire game. Must supply "
"either 'random', 'solvability' or list of deals to be "
@@ -88,6 +90,8 @@ bool command_line_helper::parse(int argc, const char* argv[]) {
solvability = (vm.count("solvability") != 0);
+ shortest_sols = (vm.count("shortest-sols") != 0);
+
// Handle logic error scenarios
return assess_errors();
}
@@ -117,6 +121,11 @@ bool command_line_helper::assess_errors() {
return false;
}
+ if (shortest_sols && solvability) {
+ print_shortest_sols_error();
+ return false;
+ }
+
if (!solitaire_type.empty()) {
return assess_sol_type();
} else {
@@ -159,6 +168,11 @@ void command_line_helper::print_too_many_opts_error() {
print_help();
}
+void command_line_helper::print_shortest_sols_error() {
+ LOG_ERROR ("Error: User cannot supply '--shortest-sols' and '--solvability'");
+ print_help();
+}
+
const vector<string> command_line_helper::get_input_files() {
return input_files;
}
@@ -186,3 +200,7 @@ bool command_line_helper::get_classify() {
bool command_line_helper::get_solvability() {
return solvability;
}
+
+bool command_line_helper::get_short_sols() {
+ return shortest_sols;
+}