def play(): """Initiate a game, using the command line arguments as configuration.""" arguments = docopt(__doc__) # start a game # parse arguments debug = arguments['-d'] use_basic_icons = arguments['-b'] max_frames = int(arguments['-f']) radiant_heroes = arguments['RADIANT_HEROES'].split(',') dire_heroes = arguments['DIRE_HEROES'].split(',') size = arguments['-s'] if size: size = tuple(map(int, size.split('x'))) else: size = DEFAULT_MAP_SIZE map_path = arguments['-m'] or DEFAULT_MAP_PATH # create and start game g = Game(radiant_heroes=radiant_heroes, dire_heroes=dire_heroes, map_file_path=map_path, world_size=size, debug=debug, use_basic_icons=use_basic_icons) g.play(max_frames)
def play(): """Initiate a game, using the command line arguments as configuration.""" arguments = docopt(__doc__) # start a game # parse arguments debug = arguments['-d'] protected = arguments['-p'] use_basic_icons = arguments['-b'] use_compressed_view = arguments['-c'] max_frames = int(arguments['-f']) radiant_heroes = arguments['RADIANT_HEROES'].split(',') dire_heroes = arguments['DIRE_HEROES'].split(',') drawers = [] if not arguments['-q']: drawers.append( TerminalDrawer(use_basic_icons=use_basic_icons, use_compressed_view=use_compressed_view)) if arguments['-r']: replay_dir = arguments['-r'] drawers.append(JsonReplayDrawer(replay_dir=replay_dir)) size = arguments['-s'] if size: size = tuple(map(int, size.split('x'))) else: size = DEFAULT_MAP_SIZE map_path = arguments['-m'] or DEFAULT_MAP_PATH # create and start game g = Game(radiant_heroes=radiant_heroes, dire_heroes=dire_heroes, map_file_path=map_path, world_size=size, debug=debug, protected=protected, drawers=drawers) os.system('clear') g.play(max_frames)
def play(): """Initiate a game, using the command line arguments as configuration.""" arguments = docopt(__doc__) # start a game # parse arguments debug = arguments['-d'] protected = arguments['-p'] use_basic_icons = arguments['-b'] use_compressed_view = arguments['-c'] max_frames = int(arguments['-f']) radiant_heroes = arguments['RADIANT_HEROES'].split(',') dire_heroes = arguments['DIRE_HEROES'].split(',') drawers = [] if not arguments['-q']: drawers.append(TerminalDrawer(use_basic_icons=use_basic_icons, use_compressed_view=use_compressed_view)) if arguments['-r']: replay_dir = arguments['-r'] drawers.append(JsonReplayDrawer(replay_dir=replay_dir)) size = arguments['-s'] if size: size = tuple(map(int, size.split('x'))) else: size = DEFAULT_MAP_SIZE map_path = arguments['-m'] or DEFAULT_MAP_PATH # create and start game g = Game(radiant_heroes=radiant_heroes, dire_heroes=dire_heroes, map_file_path=map_path, world_size=size, debug=debug, protected=protected, drawers=drawers) os.system('clear') g.play(max_frames)