17 lines
412 B
Python
17 lines
412 B
Python
with open("./input", "r") as f:
|
|
instructions = list(f.read())
|
|
cursor = [0,0]
|
|
houses = []
|
|
for instruction in instructions:
|
|
if instruction == "^":
|
|
cursor[0] += 1
|
|
if instruction == "v":
|
|
cursor[0] -= 1
|
|
if instruction == ">":
|
|
cursor[1] += 1
|
|
if instruction == "<":
|
|
cursor[1] -= 1
|
|
houses.append(f"{cursor[0]},{cursor[1]};")
|
|
|
|
print(houses)
|
|
print(len(set(houses)))
|