day23.lib package
Submodules
day23.lib.classes module
Classes for part1.
- class day23.lib.classes.Maze(data: list[list[str]])[source]
Bases:
object
2d array of chars.
- get_cell_branches(position: Position) int [source]
Returns how many branches come out of this tile.
- grid: list[list[str]]
- num_cols: int
- num_rows: int
- class day23.lib.classes.Path[source]
Bases:
object
A list of Positions.
- can_add(position: Position) bool [source]
Whether we can add a given position.
If we have already visited the position, we can’t
- last() Position [source]
Return last position in path.
- Raises:
ValueError – if we have no positions.
- Returns:
last position in path
- Return type:
- class day23.lib.classes.Position(row: int, col: int)[source]
Bases:
object
Simple 2d Vector.
- col: int
- copy_modify(row: int | None = None, col: int | None = None) Position [source]
Copies us and offsets by the given offset.
- row: int
day23.lib.classes2 module
part 2 solution.
- class day23.lib.classes2.Edge(node1: int, node2: int, path: Path, length: int = 0)[source]
Bases:
object
Edge class, representing a path between nodes.
- length: int = 0
- node1: int
- node2: int
- class day23.lib.classes2.Node(name: int, position: ~day23.lib.classes.Position, edges: list[~day23.lib.classes2.Edge] = <factory>)[source]
Bases:
object
Node representing a fork to another.
- name: int
- class day23.lib.classes2.Solver2(maze: Maze)[source]
Bases:
object
Solver for part 2.
- static calculate_edges(start_node: Node, nodes: dict[Position, Node], maze: Maze) None [source]
Calculate edges of the maze.
Modifies the maze inplace, filling it in with #. Modifies the node and its connecting nodes by adding Edges
- static expand_path(path: Path, maze: Maze) list[Path] [source]
Expands a path, nuking that section of the maze using #.
day23.lib.parsers module
Day23 parsers.
Module contents
Library functions for day23.