Roderic Day vor 3 Jahren
Ursprung
Commit
006b70ddce
1 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen
  1. +16
    -0
      y2021/p13.py

+ 16
- 0
y2021/p13.py Datei anzeigen

@@ -0,0 +1,16 @@
import toolkit


dots, instructions = text.split('\n\n')
dots = {eval(pair) for pair in dots.splitlines()}
ans1 = None
for line in instructions.splitlines():
axis, zz = line.split()[-1].split('=')
zz = int(zz)
if axis == 'x':
dots = {(x, y) if x < zz else (2 * zz - x, y) for x, y in dots}
elif axis == 'y':
dots = {(x, y) if y < zz else (x, 2 * zz - y) for x, y in dots}
if ans1 is None:
ans1 = len(dots)
ans2 = '\n' + toolkit.render({complex(*k): '#' for k in dots})

Laden…
Abbrechen
Speichern