-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata_model.py
77 lines (70 loc) · 2.37 KB
/
data_model.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
76
77
class Vector3:
x: float = 0.0
y: float = 0.0
z: float = 0.0
def parse(self, s:str):
self.x, self.y, self.z = map(float, s.strip('[]').split(";"))
def __init__(self) -> None:
self.x = self.y = self.z = 0.0
def __str__(self) -> str:
return f"[{str(self.x)};{str(self.y)};{str(self.z)}]"
def __eq__(self, __value: object) -> bool:
if self.x == self.y == self.z == __value: return True
else: return False
class Vector2:
x: float = 0.0
y: float = 0.0
def parse(self, s:str):
self.x, self.y = map(float, s.strip('[]').split(";"))
def __init__(self) -> None:
self.x = self.y = 0.0
def __str__(self) -> str:
return f"[{str(self.x)};{str(self.y)}]"
def __eq__(self, __value: object) -> bool:
if self.x == self.y == __value: return True
else: return False
class Vector3_List:
vectors = []
def parse_append(self, s:str):
self.vectors.append(Vector3.parse(s))
def __init__(self) -> None:
self.vectors = []
def __str__(self) -> str:
string = ""
for vec in self.vectors:
str(vec.x) + " " + str(vec.y) + " " + str(vec.z) + "\n"
return string
pass
class GameData:
# config data <- from game
restart: bool = False # TODO: input for restart
ai_prompting_enabled: bool = True
gpt_model_tier: int = 0 # 0: gpt 3 turbo / 1: gpt 4 turbo
lookat_direct: float = 0.84 # input for agent fov
lookat_periph: float = 0.5 # input for agent fov
distance_near: float = 5.0 # input for distance
distance_mid: float = 10.0 # input for distance
distance_far: float = 20.0 # input for distance
# config data -> to game
action_state: str = "idle" # TODO: output for debug
# base data
target_pos: Vector3
self_pos: Vector3
play_area: Vector2 # x,y amount columns/rows
cell_size: Vector2 # x,y size per grid cell
target_heading: Vector3
self_heading: Vector3
# action data
noise_position: Vector3
def __init__(self) -> None:
self.target_pos = Vector3()
self.self_pos = Vector3()
self.play_area = Vector2()
self.cell_size = Vector2()
self.target_heading = Vector3()
self.self_heading = Vector3()
self.noise_position = Vector3()
#global variables
game_data: GameData
messages: any
console_state: []