Explorar el Código

shower

master
Roderic Day hace 3 años
padre
commit
006b70ddce
Se han modificado 1 ficheros con 16 adiciones y 0 borrados
  1. +16
    -0
      y2021/p13.py

+ 16
- 0
y2021/p13.py Ver fichero

@@ -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})

Cargando…
Cancelar
Guardar