19 lines
516 B
Python
19 lines
516 B
Python
#!/usr/bin/env python
|
|
visited_houses = []
|
|
current_house = (0, 0)
|
|
|
|
with open("inputd3.txt", "r") as f:
|
|
for input in f:
|
|
for x in input:
|
|
if x == "^":
|
|
current_house = (current_house[0] - 1, current_house[1])
|
|
elif x == "v":
|
|
current_house = (current_house[0] + 1, current_house[1])
|
|
elif x == ">":
|
|
current_house = (current_house[0], current_house[1] + 1)
|
|
else:
|
|
current_house = (current_house[0], current_house[1] - 1)
|
|
|
|
visited_houses.append(current_house)
|
|
|
|
print(len(set(visited_houses)))
|