day19 package

Subpackages

Submodules

day19.day19 module

Day19 solution.

day19.day19.get_input(path: str) tuple[list[Workflow], list[Part]][source]

Open file and parse.

Returns well formed workflows and parts classes.

Parameters:

path (str) – filepath for data

Returns:

list of workflows and parts.

Return type:

tuple[list[Workflow], list[Part]]

day19.day19.main() None[source]

Load input file and run part1/part2.

day19.day19.part1(workflows: list[Workflow], parts: list[Part]) int[source]

Solve part1.

day19.day19.part2(workflows: list[Workflow]) int[source]

Solve part2.

day19.day19.process_part(workflows: dict[str, Workflow], part: Part) int[source]

Processes a part.

Returns the part rating (or 0 if rejected)

Parameters:
  • workflows (dict[str, Workflow]) – list of workflows.

  • part (Part) – part to process

Returns:

value of part (or 0 if rejected)

Return type:

int

day19.day19.solve_part2(workflows: dict[str, Workflow]) int[source]

Solve part2.

Assumes xmas values from 0 <= xmas <= 4000. Returns total number of parts that pass.

Parameters:

workflows (dict[str, Workflow]) – workflows to test

Returns:

total number of parts that pass.

Return type:

int

Module contents

Day19 solution.