-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv5strategy.py
More file actions
40 lines (31 loc) · 1.24 KB
/
v5strategy.py
File metadata and controls
40 lines (31 loc) · 1.24 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
38
39
40
import random
from typing import Tuple
from V5RPC import *
from adapter.v5rpc import *
def on_event(event_type: int, args: EventArguments):
event = {
0: lambda: print(args.judge_result.reason),
1: lambda: print("Match Start"),
2: lambda: print("Match Stop"),
3: lambda: print("First Half Start"),
4: lambda: print("Second Half Start"),
5: lambda: print("Overtime Start"),
6: lambda: print("Penalty Shootout Start")
}
event[event_type]()
def get_team_info(server_version: int) -> str:
version = {
0: "V1.0",
1: "V1.1"
}
print(f'server rpc version: {version.get(server_version, "V1.0")}')
return 'Python Strategy Server'
def get_instruction(field: Field):
print(field.tick) # tick从2起始
if field.tick % 60 != 0:
return [(20, -20), (10, 10), (0, 0), (0, 0), (0, 0)], 0
else:
return [(20, -20), (10, 10), (0, 0), (0, 0), (0, 0)], 1 # 以第二元素的(0,1)表明重置开关,1表示重置
def get_placement(field: Field) -> List[Tuple[float, float, float]]:
return [(42, 42, 180), (42, 42, 180), (42, 42, 180), (42, 42, 180), (42, 42, 180),
(0.0, 0.0, 0.0)] # 最后一个是球位置(x,y,角),角其实没用