You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
419 B
Python

with open("input") as f:
puzzle_input = f.read()
# puzzle_input = "^v^v^v^v^v"
coords = (0, 0)
delivered_houses = set()
delivered_houses.add(coords)
MOVEMENTS = {">": (1, 0), "^": (0, 1), "<": (-1, 0), "v": (0, -1)}
for char in puzzle_input:
[d_x, d_y] = MOVEMENTS[char]
coords = (coords[0] + d_x, coords[1] + d_y)
delivered_houses.add(coords)
print(delivered_houses)
print(len(delivered_houses))