add output directory

This commit is contained in:
Maximilian Keßler 2023-11-20 12:31:08 +01:00
parent c829cd1afd
commit 06156d15e7
Signed by: max
GPG key ID: BCC5A619923C0BA5

View file

@ -155,10 +155,10 @@ if __name__ == "__main__":
fieldnames += sort_players_by_num_games(games)
fieldnames += ['Other']
with open('games.csv', 'w', newline='') as f:
with open('out/games.csv', 'w', newline='') as f:
f.writelines([','.join(fieldnames), "\n"])
with open('games.csv', 'a', newline='') as f:
with open('out/games.csv', 'a', newline='') as f:
writer = csv.DictWriter(f, fieldnames=fieldnames)
for game_id, entry in sorted(games.items()):
bdrs, termination = analysis[game_id]
@ -186,10 +186,10 @@ if __name__ == "__main__":
writer.writerow(row)
fieldnames = ['Game ID'] + [str(i) for i in range(1, 16)]
with open('endgames.csv', 'w', newline='') as f:
with open('out/endgames.csv', 'w', newline='') as f:
f.writelines([','.join(fieldnames), "\n"])
with open('endgames.csv', 'a', newline='') as f:
with open('out/endgames.csv', 'a', newline='') as f:
writer = csv.DictWriter(f, fieldnames=fieldnames)
for game_id, endgame in sorted(endgames.items()):
endgame['Game ID'] = "<a href='https://hanab.live/replay/{}'>{}</a>".format(game_id, game_id)
@ -199,9 +199,9 @@ if __name__ == "__main__":
fieldnames = ['Game ID'] + [str(i) for i in range(1, 11)]
for clue_modifier in range(-2, 3):
filename = 'endgames{}.csv'.format(clue_modifier)
with open(filename, 'w') as f:
with open('out/' + filename, 'w') as f:
f.writelines([','.join(fieldnames), "\n"])
with open(filename, 'a') as f:
with open('out/' + filename, 'a') as f:
writer = csv.DictWriter(f, fieldnames=fieldnames)
for game_id, endgame in sorted(all_endgames.items()):
# print(endgame)
@ -216,11 +216,11 @@ if __name__ == "__main__":
print('processed file {}'.format(filename))
x = pandas.read_csv(filename)
x.to_html('endgames_{}.html'.format(clue_modifier), escape=False)
x = pandas.read_csv('out/' + filename)
x.to_html('out/endgames_{}.html'.format(clue_modifier), escape=False)
a = pandas.read_csv("games.csv")
a.to_html("games.html", escape=False)
a = pandas.read_csv("out/games.csv")
a.to_html("out/games.html", escape=False)
b = pandas.read_csv('endgames.csv')
b.to_html("endgames.html", escape=False)
b = pandas.read_csv('out/endgames.csv')
b.to_html("out/endgames.html", escape=False)