from ants_plans import *
def start_with_strategy(args, strategy, ants):
“””Reads command-line arguments and starts a game with those options.”””
Copyright By PowCoder代写 加微信 powcoder
import argparse
parser = argparse.ArgumentParser(description=”Play Ants vs. SomeBees”)
parser.add_argument(‘-d’, type=str, metavar=’DIFFICULTY’,
help=’sets difficulty of game (test/easy/normal/hard/extra-hard)’)
parser.add_argument(‘-w’, ‘–water’, action=’store_true’,
help=’loads a full layout with water’)
parser.add_argument(‘–food’, type=int,
help=’number of food to start with when testing’, default=2)
args = parser.parse_args()
assault_plan = make_normal_assault_plan(ants)
layout = ants.dry_layout
tunnel_length = 10
num_tunnels = 3
food = args.food
if args.water:
layout = ants.wet_layout
if args.d in [‘t’, ‘test’]:
assault_plan = make_test_assault_plan(ants)
num_tunnels = 1
elif args.d in [‘e’, ‘easy’]:
assault_plan = make_easy_assault_plan(ants)
num_tunnels = 2
elif args.d in [‘n’, ‘normal’]:
assault_plan = make_normal_assault_plan(ants)
num_tunnels = 3
elif args.d in [‘h’, ‘hard’]:
assault_plan = make_hard_assault_plan(ants)
num_tunnels = 4
elif args.d in [‘i’, ‘extra-hard’]:
assault_plan = make_extra_hard_assault_plan(ants)
num_tunnels = 4
beehive = ants.Hive(assault_plan)
dimensions = (num_tunnels, tunnel_length)
return ants.GameState(strategy, beehive, ants.ant_types(), layout, dimensions, food).simulate()
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com