-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
30 lines (22 loc) · 865 Bytes
/
main.py
File metadata and controls
30 lines (22 loc) · 865 Bytes
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
import importlib
import sys
from util import Arguments
if __name__ == '__main__':
args = Arguments()
player = args.get('player', 'agent')
screen = args.get('screen', 'medium')
steps = args.get_int('steps', None)
train = args.get('train', None)
speed = args.get('speed', 'fast' if train else 'slow')
restart = args.get_int('restart', None)
output = args.get('output', 'graphics')
from frogger.settings import settings
settings['use_graphics'] = (output.lower() != 'text')
from frogger.frogger import Frogger
game = Frogger(screen)
if player != 'human':
agent_module = importlib.import_module(player)
agent = agent_module.Agent(train=train)
game.add_agent(agent)
scores = game.run(steps=steps, speed=speed, restart=restart)
print('\t'.join([str(score) for score in scores]))