diff --git a/src/main.cpp b/src/main.cpp index 081cfa7..9b83e10 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -11,9 +11,9 @@ namespace Hanabi { - void analyze_game_and_start_cli(std::variant game_id, int turn, std::optional score_goal, + void analyze_game_and_start_cli(std::variant game_id, int turn, int draw_pile_size, std::optional score_goal, bool start_cli) { - auto game = Download::get_game(game_id, turn, 0, score_goal); + auto game = Download::get_game(game_id, turn, draw_pile_size, score_goal); if (game == nullptr) { if(game_id.index() == 0) { std::cout << "Failed to download game " << std::get(game_id) << " from hanab.live." << std::endl; @@ -49,7 +49,8 @@ namespace Hanabi { int main(int argc, char *argv[]) { - int turn; + int turn = 100; + int draw_pile_size = 0; std::optional score; bool interactive_shell; @@ -58,7 +59,8 @@ int main(int argc, char *argv[]) { ("help", "print this help message") ("id,g", boost::program_options::value(), "Game ID from hanab.live") ("file,f", boost::program_options::value(), "Input file containing game in hanab.live json format") - ("turn,t", boost::program_options::value(&turn)->default_value(1), "Turn number of state to analyze. Turn 1 means no actions have been taken.") + ("turn,t", boost::program_options::value(&turn), "Turn number of state to analyze. Turn 1 means no actions have been taken.") + ("draw,d", boost::program_options::value(&draw_pile_size), "Draw pile size of state to analyze.") ("score,s", boost::program_options::value(), "Score that counts as a win, i.e. is optimized for achieving.") ("interactive,i", boost::program_options::value(&interactive_shell)->default_value(true), "Drop into interactive shell to explore game") ; @@ -77,14 +79,20 @@ int main(int argc, char *argv[]) { return EXIT_SUCCESS; } + if (vm.count("draw") + vm.count("turn") != 1) { + std::cout << "Exactly one option of 'draw' and 'turn' has to be given." << std::endl; + std::cout << "Use '--help' to print a help message." << std::endl; + return EXIT_SUCCESS; + } + if (vm.count("score")) { score = vm["score"].as(); } if (vm.count("file")) { - Hanabi::analyze_game_and_start_cli(vm["file"].as().c_str(), turn, score, interactive_shell); + Hanabi::analyze_game_and_start_cli(vm["file"].as().c_str(), turn, draw_pile_size, score, interactive_shell); } else { - Hanabi::analyze_game_and_start_cli(vm["id"].as(), turn, score, interactive_shell); + Hanabi::analyze_game_and_start_cli(vm["id"].as(), turn, draw_pile_size, score, interactive_shell); } return EXIT_SUCCESS; }