def run(*args): """Read in the command-line argument and calls corresponding functions. This function uses Python syntax/techniques not yet covered in this course. """ import argparse parser = argparse.ArgumentParser(description="Play Hog") parser.add_argument( '--final', action='store_true', help='Display the final_strategy win rate against always_roll(5)') parser.add_argument('--run_experiments', '-r', action='store_true', help='Runs strategy experiments') args = parser.parse_args() if args.run_experiments: run_experiments() elif args.final: from hog_eval import final_win_rate win_rate = final_win_rate() print('Your final_strategy win rate is') print(' ', win_rate) print('(or {}%)'.format(round(win_rate * 100, 2)))
def run(*args): """Read in the command-line argument and calls corresponding functions. This function uses Python syntax/techniques not yet covered in this course. """ import argparse parser = argparse.ArgumentParser(description="Play Hog") parser.add_argument('--final', action='store_true', help='Display the final_strategy win rate against always_roll(5)') parser.add_argument('--run_experiments', '-r', action='store_true', help='Runs strategy experiments') args = parser.parse_args() if args.run_experiments: run_experiments() elif args.final: from hog_eval import final_win_rate win_rate = final_win_rate() print('Your final_strategy win rate is') print(' ', win_rate) print('(or {}%)'.format(round(win_rate * 100, 2)))