-
Notifications
You must be signed in to change notification settings - Fork 5
/
cache_compositions.py
35 lines (24 loc) · 1 KB
/
cache_compositions.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
from models.challenges_tools import complete_comp
from models.challenges_tools import find_challenges
from models.champions_positions import best_fit_positions
from collections import defaultdict
import json
import tqdm
comps = defaultdict(list)
previous_sizes = None
for comp in tqdm.tqdm(complete_comp(selected_champions=set([]), selected_challenges=set([]), limit=1e7)):
comp_challenges = find_challenges(comp)
if len(comp_challenges) < 6:
continue
comp_roles, attribution_score, off_role = best_fit_positions(comp)
comp_str = str(sorted(list(comp)))
key = f"{len(comp_challenges)} challenges compositions"
comps[key].append((comp_roles, list(comp_challenges), attribution_score))
current_sizes = [len(l) for l in comps.values()]
if current_sizes != previous_sizes:
print(current_sizes)
previous_sizes = current_sizes
comps = dict(comps)
for k, v in comps.items():
print(k, len(v))
json.dump(comps, open("static/cache_compositions/compositions.json", "w"))