-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_inputs.py
75 lines (62 loc) · 2.48 KB
/
game_inputs.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
"""
This module provides GameInputs class representing the inputs to a game
"""
import multiprocessing as mp
class GameInputs:
"""
A class representing the inputs to a game.
Attributes:
__a_agent_inputs_state (mp.Queue): Inputs describing state of the game, such as car speed,
car distance offset,lap progress, and road centre incline.
__a_game_initialization_inputs (mp.Queue): Inputs given by initializing game, such as game
speed and initialization state.
__a_game_restart_inputs (mp.Queue): Inputs given if restart is needed.
"""
# Inputs Describing State of The Game
# e.g. Car Speed, Car Distance Offset, Lap Progress, Road Centre Incline
__a_agent_inputs_state: mp.Queue
# Inputs Given By Initializing Game
# e.g. Game Speed, Initialization State
__a_game_initialization_inputs: mp.Queue
# Inputs Given If Restart is Needed
__a_game_restart_inputs: mp.Queue
# Settings from Agent to Game
__a_agent_settings_to_game: mp.Queue
def __init__(self, par_agent_inputs_state: mp.Queue, par_game_initialization_inputs: mp.Queue,
par_game_restart_inputs: mp.Queue, par_agent_settings_to_game: mp.Queue):
self.__a_agent_inputs_state = par_agent_inputs_state
self.__a_game_initialization_inputs = par_game_initialization_inputs
self.__a_game_restart_inputs = par_game_restart_inputs
self.__a_agent_settings_to_game = par_agent_settings_to_game
@property
def agent_inputs_state(self) -> mp.Queue:
"""
Gets the inputs describing state of the game.
Returns:
mp.Queue: The queue containing the inputs.
"""
return self.__a_agent_inputs_state
@property
def game_initialization_inputs(self) -> mp.Queue:
"""
Gets the inputs given by initializing game.
Returns:
mp.Queue: The queue containing the inputs.
"""
return self.__a_game_initialization_inputs
@property
def game_restart_inputs(self) -> mp.Queue:
"""
Gets the inputs given by initializing game.
Returns:
mp.Queue: The queue containing the inputs.
"""
return self.__a_game_restart_inputs
@property
def agent_settings_to_game(self) -> mp.Queue:
"""
Gets the settings given by agent to a game
Returns:
mp.Queue: The queue containing the settings.
"""
return self.__a_agent_settings_to_game