add results of bot games to table

This commit is contained in:
Maximilian Keßler 2023-11-20 17:01:07 +01:00
parent beecacb897
commit 92f8e124bf
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -247,14 +247,15 @@ def create_replay_links(ids: List[int], strategy: str):
outfile = Path('out/{}_links.csv'.format(strategy))
with open(outfile, 'w') as f:
writer = csv.writer(f)
writer.writerow(["Game ID", "{} Replay Link".format(strategy)])
writer.writerow(["Game ID", "Result", "{} Replay Link".format(strategy)])
for game_id in ids:
replay = get_game_json(game_id, strategy)
instance, actions = parse_json_game(replay)
game = HanabLiveGameState(instance)
for action in actions:
game.make_action(action)
writer.writerow([game_id, link(game)])
bdrs, termination = describe_game(replay)
writer.writerow([game_id, 'Win' if game.is_won() else termination, link(game)])
x = pandas.read_csv(outfile)
x.to_html(outfile.with_suffix('.html'), render_links=True)