day10 package

Subpackages

Submodules

day10.day10 module

day10 solution.

day10.day10.calculate_s(start: Position, pipe_map: PipeMap) str[source]

Calculate what the “S” character is as a pipe.

We should have exactly two pipes going into us

Parameters:
Raises:
  • ValueErrorS doesn’t have any connecting pipes

  • AssertionErrorS does not match any known pipe.

Returns:

The character representing the pipe

Return type:

str

day10.day10.expand_map(pipe_map: PipeMap) PipeMap[source]

Expands each pipe into a 3x3 tile.

day10.day10.expand_pipe(character: str, is_loop: bool) tuple[str, str, str][source]

Expands a pipe character to big boi 3x3.

day10.day10.find_cycles(pipe_map: PipeMap) list[Pipe][source]

Finds the pipe path starting from S.

day10.day10.find_s(pipe_map: PipeMap) Position[source]

Finds the S pipe.

day10.day10.flood_fill(pipe_map: PipeMap) int[source]

Flood fills a pipemap from one starting tile.

Parameters:

pipe_map (PipeMap) – pipemap to fill

Returns:

how many tiles were filled

Return type:

int

day10.day10.main() None[source]

Read input and run part1/part2.

day10.day10.part1(pipe_map: PipeMap) int[source]

Finds length of S loop.

day10.day10.part2(pipe_map: PipeMap) int[source]

Finds tiles “inside” the loop.

day10.day10.process_big_input_line(row: int, line: str) list[Pipe][source]

Process a single line of input.

day10.day10.process_input_line(row: int, line: str) list[Pipe][source]

Process a single line of input.

day10.day10.read_input(path: str) PipeMap[source]

Read the map.

day10.day10.reduce_map(big_map: PipeMap, small_map: PipeMap) PipeMap[source]

Converts from fat map back down to small map.

Module contents

Day10 solution.