day20 package
Subpackages
Submodules
day20.day20 module
Day20 solution.
- day20.day20.export_graph(dots: list[Graph], module_groups: ModuleGroups, simulation_counter: int, export_graphs: bool) None [source]
Export a graphviz datatype if graphing is enabled.
- day20.day20.get_loop_paths(start_switch: str, module_map: dict[str, BaseModule]) list[BaseModule] [source]
Given a start path, returns the longest path until we hit a conjunction module.
It should be n FlipFlops and then a single conjunction
- day20.day20.get_module_groups(module_map: dict[str, BaseModule]) ModuleGroups [source]
Splits the modules into their respective pipelines.
- day20.day20.get_typed_module(module_map: dict[str, BaseModule], key: str, module_type: Type[T]) T [source]
Typecast a module.
- day20.day20.graph_modules(module_groups: ModuleGroups, index: int) Digraph [source]
Graphs the modules.
- day20.day20.output_files(dots: list[Graph], directory: str) None [source]
Saves a list of dots to file.
- day20.day20.output_graph_wrapper(args: tuple[Graph, str]) None [source]
Since process_map doesnt support star_args, we gotta use this.
- day20.day20.part1(modules: list[BaseModule]) int [source]
Counts low/high count for each module.
- day20.day20.part2(modules: list[BaseModule], export_graphs: bool = False) tuple[int, list[Graph]] [source]
We find out the loop length for each of the 4~ paths.
- day20.day20.path_is_start_state(modules: list[BaseModule]) bool [source]
For every module in the path, make sure its in its “initial” state.
- day20.day20.simulate(modules: dict[str, BaseModule], stored_pulses: list[PulseTarget] | None = None) tuple[int, int] [source]
Simulate a list of modules.
If you pass in stored_pulses, we will append every pulse to it
Module contents
Day20 solution.