diff options
| author | nekineki <nekineki@nekineki.net> | 2022-12-21 21:10:08 +0100 |
|---|---|---|
| committer | nekineki <nekineki@nekineki.net> | 2022-12-21 21:10:29 +0100 |
| commit | dcc2e3092ad021d05b25f9cdd514ba8767463905 (patch) | |
| tree | 660f80716d07466817cc0fd3d50ebce615d412cc /2022 | |
| parent | 2618270a477debfabe463be1e5afe60306d2e53f (diff) | |
day21 oneline
Diffstat (limited to '2022')
| -rwxr-xr-x | 2022/day21-oneline.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/2022/day21-oneline.py b/2022/day21-oneline.py new file mode 100755 index 0000000..1124b89 --- /dev/null +++ b/2022/day21-oneline.py @@ -0,0 +1,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']] + |
