Watch
1
0
Fork
You've already forked advent-of-code
0

2017 Day 11 Part 2

This commit is contained in:
Jeremy Kaplan 2025-08-12 20:27:21 -04:00
commit dd0755e2dc

View file

@ -31,6 +31,17 @@ def part1():
return distance(walk(steps))
def part2():
steps = map(Direction.parse, aoc.puzzle_input(11).split(","))
pos = (0, 0, 0)
far = pos
for step in steps:
pos = move(pos, step)
if distance(pos) > distance(far):
far = pos
return distance(far)
def walk(steps: Iterable[Direction]) -> HexPos:
pos = (0, 0, 0)
for step in steps:
@ -57,3 +68,4 @@ def move(pos: HexPos, dir: Direction) -> HexPos:
print(part1())
print(part2())