-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstart.py
More file actions
37 lines (30 loc) · 1.08 KB
/
Copy pathstart.py
File metadata and controls
37 lines (30 loc) · 1.08 KB
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
"""
Entry point for the Asteroids Game / AI.
Usage: python start.py [--help]
"""
from ai.ai_app import AI_App
from ai.experiment import run_experiment
from ai.utils import algorithm_id_to_ai_brain_class
from asteroids.app import App
from settings import get_settings, load_settings_from_cli
if __name__ == "__main__":
# Configure settings according to command line arguments
load_settings_from_cli()
settings = get_settings()
# Start the game if specified
if settings.RUN_MODE == settings.GAME:
if settings.USE_PREDETERMINED_SEEDS:
seed = settings.PREDETERMINED_SEEDS[0]
else:
seed = None
if settings.PLAYER_MODE == settings.HUMAN:
App().start_game(seed=seed)
else:
ai_brain_class = algorithm_id_to_ai_brain_class(
settings.ALGORITHM_ID
)
ai_brain = ai_brain_class.load(settings.GAME_AI_BRAIN)
AI_App().start_game(ai_brain, seed=seed)
# Start experiment if specified
elif settings.RUN_MODE == settings.EXPERIMENT:
run_experiment()