-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathview_test.py
25 lines (17 loc) · 931 Bytes
/
view_test.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
# Set up the Environment.
import time
from kaggle_environments import make
# opponent = "football/idle.py"
# opponent = "football/rulebaseC.py"
opponent = "builtin_ai"
video_title = "chain"
video_path = "videos/" + video_title + "_" + opponent.split("/")[-1].replace(".py", "") + str(int(time.time())) + ".webm"
env = make("football",
configuration={"save_video": True, "scenario_name": "11_vs_11_kaggle", "running_in_notebook": False},
info={"LiveVideoPath": video_path},
debug=True)
output = env.run(["submission.py", opponent])[-1]
scores = [output[i]['observation']['players_raw'][0]['score'][0] for i in range(2)]
print('Left player: score = %s, status = %s, info = %s' % (scores[0], output[0]['status'], output[0]['info']))
print('Right player: score = %s, status = %s, info = %s' % (scores[1], output[1]['status'], output[1]['info']))
env.render(mode="human", width=800, height=600)