aoc2022/d11/part2.py

21 lines
415 B
Python

import sys
mod = __import__(sys.argv[1])
M = mod.M
for r in range(10*1000):
print(f"\rround {r+1}",end='')
for m in M:
items = m[0]
m[3] += len(items)
for _ in range(len(items)):
i = items.popleft()
ni = m[1](i) #// 3
nm = m[2](ni)
M[nm][0].append(ni)
print()
L=list(m[3] for m in M)
print(L)
LS=list(sorted(L))
print(LS[-1]*LS[-2])