day17.lib package
Submodules
day17.lib.classes module
classes for day 17.
- class day17.lib.classes.SolutionCache(num_rows: int, num_cols: int, cache_min: int, cache_max: int)[source]
Bases:
object
2d array of tilecaches.
- class day17.lib.classes.Step(total_cost: int, row: int, col: int, direction: Direction, consecutive_steps: int, src_step: Step | None)[source]
Bases:
object
Represents one “step”, which could be a multi-step.
- col: int
- consecutive_steps: int
- row: int
- total_cost: int
- class day17.lib.classes.TileCache(cache_min: int, cache_max: int)[source]
Bases:
object
A cache of shortest routes to a tile from each direction.
- cache_max: int
- cache_min: int
- class day17.lib.classes.WorldPart1(costs: list[list[int]])[source]
Bases:
object
World for part1.
- costs: list[list[int]]
- create_step(step: Step, direction: Direction) Step | None [source]
Create step from previous step and a given direction.
Returns None if the step is invalid or suboptimal
- is_oob(row: int, col: int) bool [source]
Returns if we are out of bounds.
- Parameters:
row (int) – row to check
col (int) – col to check
- Returns:
if we are out of bounds.
- Return type:
bool
- num_cols: int
- num_rows: int
day17.lib.direction module
Direction class.
- class day17.lib.direction.Direction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
IntEnum
Simple direction enum.
- EAST = 1
- NORTH = 0
- SOUTH = 2
- WEST = 3
day17.lib.parsers module
parse input file.
Module contents
library modules for day 17.