day08 package
Subpackages
Submodules
day08.day8 module
day8 solution.
- class day08.day8.Cycle(start_location: Location, location_steps: list[LocationStep], cycle_start: LocationStep)[source]
Bases:
object
Find a cycle.
- property cycle_length: int
Return length of the repeating part.
- cycle_start: LocationStep
- cycle_start_index: int
- end_zs: list[int]
- get_location(index: int) LocationStep [source]
Gets a location given a step index.
- location_steps: list[LocationStep]
- class day08.day8.Directions(steps: str)[source]
Bases:
object
Simple directions string.
- steps: str
- class day08.day8.Location(name: str, left: str, right: str)[source]
Bases:
object
A location on our map, with names of other locations.
- left: str
- name: str
- right: str
- class day08.day8.LocationStep(location: Location, steps: int)[source]
Bases:
object
Location + how many steps to get here.
- steps: int
- day08.day8.find_cycle(location: Location, world_map: WorldMap, directions: Directions) Cycle [source]
Finds the cycle from a start location.
- day08.day8.follow_directions(directions: Directions, world_map: WorldMap) int [source]
Follows directions until we hit zzz.
- day08.day8.follow_directions_multi(directions: Directions, world_map: WorldMap) int [source]
Follow all mappings ending in A until all of them are ZZZ.
- day08.day8.get_location_as(world_map: WorldMap) list[Location] [source]
Returns locations with an A at the end.
- day08.day8.read_input(path: str) tuple[Directions, WorldMap] [source]
Reads input into directions/world_map.
Module contents
Day08 solution.