-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathants_strategies.py
42 lines (37 loc) · 1.59 KB
/
ants_strategies.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from ants_plans import *
def start_with_strategy(args, strategy, ants):
"""Reads command-line arguments and starts a game with those options."""
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()