aboutsummaryrefslogtreecommitdiff
path: root/src/main/command_line_helper.cpp
diff options
context:
space:
mode:
authorthecharlesblake2017-10-27 23:25:50 +0100
committerthecharlesblake2017-10-27 23:36:39 +0100
commita841befd0ecdc0b469d6bc46b209f259358778ec (patch)
tree8ce11ab3208fb499befe8814536a27778c949210 /src/main/command_line_helper.cpp
parentBH Solver with path outputted, based on user input (diff)
downloadmetasol-a841befd0ecdc0b469d6bc46b209f259358778ec.tar.gz
metasol-a841befd0ecdc0b469d6bc46b209f259358778ec.zip

Add random game generation to bh

Diffstat (limited to 'src/main/command_line_helper.cpp')
-rw-r--r--src/main/command_line_helper.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/main/command_line_helper.cpp b/src/main/command_line_helper.cpp
index 9e389fd..67bf7ff 100644
--- a/src/main/command_line_helper.cpp
+++ b/src/main/command_line_helper.cpp
@@ -15,13 +15,14 @@ using namespace std;
namespace po = boost::program_options;
command_line_helper::command_line_helper()
- : main_options("options") {
+ : main_options("options"), random_deal(-1) {
main_options.add_options()
("help", "produce help message")
("type", po::value<string>(),
"specify the type of the solitaire game to be solved (REQUIRED)")
- ("random", "create and solve a random solitaire deal");
+ ("random", po::value<int>(), "create and solve a random solitaire "
+ "deal based on a seed");
po::options_description hidden_options("Hidden options");
hidden_options.add_options()
@@ -55,7 +56,9 @@ bool command_line_helper::parse(int argc, const char* argv[]) {
solitaire_type = vm["type"].as<string>();
}
- random_deal = vm.count("random");
+ if (vm.count("random")) {
+ random_deal = vm["random"].as<int>();
+ }
// Handle logic error scenarios
return assess_errors();
@@ -114,7 +117,7 @@ const string command_line_helper::get_solitaire_type() {
return solitaire_type;
}
-bool command_line_helper::get_random_deal() {
+int command_line_helper::get_random_deal() {
return random_deal;
}