-
Notifications
You must be signed in to change notification settings - Fork 0
/
V5RPC.py
84 lines (59 loc) · 1.3 KB
/
V5RPC.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
78
79
80
81
82
83
84
"""
This is types and helpers for strategies with PyV5Adapter.
"""
from typing import Optional, List
def catchall(fun):
"""Catch all exceptions in function."""
def inner(*args):
try:
return fun(*args)
except Exception as ex:
print('An error is caught by @catchall:')
print(ex)
return inner
class Team:
Self = 0
Opponent = 1
Nobody = 2
class EventType:
JudgeResult = 0
MatchStart = 1
MatchStop = 2
FirstHalfStart = 3
SecondHalfStart = 4
OvertimeStart = 5
PenaltyShootoutStart = 6
class JudgeResultEvent:
class ResultType:
PlaceKick = 0
GoalKick = 1
PenaltyKick = 2
FreeKickRightTop = 3
FreeKickRightBot = 4
FreeKickLeftTop = 5
FreeKickLeftBot = 6
type: int # ResultType
offensive_team: int # Team
reason: str
class EventArguments:
judge_result: Optional[JudgeResultEvent]
class Version:
V1_0 = 0
V1_1 = 1
class Vector2:
x: float
y: float
class Wheel:
left_speed: float
right_speed: float
class Robot:
position: Vector2
rotation: float
wheel: Wheel
class Ball:
position: Vector2
class Field:
self_robots: List[Robot]
opponent_robots: List[Robot]
ball: Ball
tick: int