Day 8: Haunted Wasteland [AOC2023 Python]

preview_player
Показать описание
For Advent of Code 2023 Day 8, I get a series of left/right instructions, and a series of nodes and what comes to the left and right of them. In part 1, I just need to walk the path from AAA to ZZZ counting steps. In part 2, I'll need to track six ghosts at once, each from different starting places to end points. I'll calcuate their cycle length, and use the LCM to get the answer.

#adventofcode #python

[00:00] Part 1 description
[01:19] Input analysis
[01:51] Parsing input
[05:57] Walking the path
[07:33] Running on examples and solving
[08:05] Part 2 description
[09:15] How many ghosts
[09:55] Looking at cycles in AAA
[11:48] Fixing play script
[12:33] Looking at cycle length
[15:26] Cycle time for each ghost
[19:11] Getting LCM of cycles
[19:50] Summary
Рекомендации по теме