-
Notifications
You must be signed in to change notification settings - Fork 1
/
stats.py
executable file
·37 lines (33 loc) · 1.08 KB
/
stats.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
#!/usr/bin/python3
from functools import reduce
import json
import os
if __name__ == "__main__":
all = set()
winners = {
"part-1-initial": {},
"part-2-teleports": {},
"part-3-clones": {},
}
for (d, _, fs) in os.walk("."):
d = d[2:]
if "part-" in d:
for f in fs:
if ".meta" in f:
with open(d + os.sep + f) as fin:
x = json.load(fin)
for k in x:
if k != "bestTime":
all.add(k)
if x[k] == x["bestTime"]:
winners[d][k] = winners[d].get(k, 0) + 1
all_winners = set()
for d in winners:
print("Winners in %s:" % d)
for s in sorted(winners[d], key=lambda k: -winners[d][k]):
print(" %s: %d" % (s, winners[d][s]))
all_winners = all_winners.union(set(winners[d]))
print()
print("Non-winning strategies:")
for s in sorted(all - all_winners):
print(" %s" % s)