Day 13
This commit is contained in:
19
day13/part1.py
Normal file
19
day13/part1.py
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
lines = (x.strip() for x in open("input.txt"))
|
||||
points = set()
|
||||
# 1311,895
|
||||
|
||||
for line in lines:
|
||||
if line.startswith("fold along x="):
|
||||
mark = int(line[13:])
|
||||
points = set((x if mark > x else 2*mark-x, y) for x, y in points if mark != x)
|
||||
break
|
||||
elif line.startswith("fold along y="):
|
||||
mark = int(line[13:])
|
||||
points = set((x, y if mark > y else 2*mark-y) for x, y in points if mark != y)
|
||||
break
|
||||
elif len(line) > 0:
|
||||
points.add(tuple(int(num) for num in line.split(",")))
|
||||
|
||||
print(len(points))
|
||||
Reference in New Issue
Block a user