summaryrefslogtreecommitdiff
path: root/2022/day21-oneline.py
blob: 1124b890f9a1cf67ab78c1f84cd073fa637d9827 (plain)
1
2
3
4
5
6
7
#!/usr/bin/env python3

filename = "in/day21.ref"
# filename = "in/day21.pzl"

[exec(f"def {line.strip().split(':')[0]}(): return {int(line.strip().split(':')[1].strip())}", globals()) if (line != 'asdf' and line.strip().split(':')[1].strip().isnumeric()) else exec(f"def {line.strip().split(':')[0]}(): return {line.strip().split(':')[1].strip().split(' ')[0]}() {line.strip().split(':')[1].strip().split(' ')[1]} {line.strip().split(':')[1].strip().split(' ')[2]}()", globals()) if line != 'asdf' else exec('print(root())', globals()) for line in open(filename).readlines() + ['asdf']]