From dd0755e2dcf693480ed8f0d0bf0e64f019f294a8 Mon Sep 17 00:00:00 2001 From: Jeremy Kaplan Date: Tue, 12 Aug 2025 20:27:21 -0400 Subject: [PATCH] 2017 Day 11 Part 2 --- 2017/day11.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/2017/day11.py b/2017/day11.py index a8af405..5d83b93 100644 --- a/2017/day11.py +++ b/2017/day11.py @@ -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())