-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
54 lines (38 loc) · 1.55 KB
/
main.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
# from kaggle_environments import make, evaluate
# from submission import TimeValueAgent, time_value_agent
# from random_agent import random_agent
# """Trainingsplatz zum testen der programmierten Bots."""
# def main(gegner="random"):
# env = make("halite", debug=True)
# # time_value_agent = TimeValueAgent()
# env.agents = {
# "timevalue": time_value_agent,
# "random": random_agent,
# }
# env.run(["timevalue", "timevalue", "timevalue", "timevalue"])
# out = env.render(mode="html")
# f = open("wiederholung.html", "w")
# f.write(out)
# f.close
# print("Spielende! Der Spielablauf befindet sich in der Datei wiederholung.html")
# if __name__ == "__main__":
# main()
from kaggle_environments import evaluate, make
# pip install kaggle_environments
# pip install requests
"""Trainingsplatz zum testen der programmierten Bots."""
def Testspiel(submission, gegner="random"):
# Erstellen des Spieles und Angabe der spielenden Submissions
env = make("halite", debug=True)
env.run([submission, gegner, gegner, gegner])
# Rendern des Spielablaufes und Ausgabe als html-Datei
out = env.render(mode="html")
f = open("wiederholung.html", "w")
f.write(out)
f.close
print("Spielende! Der Spielablauf befindet sich in der Datei wiederholung.html")
# Lade den Agent aus der Datei
agent = "submission.py"
# Spielen des Testspiels gegen drei "random" Agents
# Es kann, wenn gewünscht, der Dateiname eines anderen gegnerischen Agenten übergeben werden (z.B. "idleBot.py")
Testspiel(agent)