Module day17

Source
Expand description

§Conway Cubes

Solving this problem reveals an interesting insight that the active cells are very sparse. Of the total possible volume of the cube formed by the maximum extents in part one, only roughly 8% is active and of the hypercube from part two only 3% is active for my input.

To speed things up our high level strategy will flip from a “pull” model where we check the surrounding neighbors of each cell, to a “push” model where we update the neighbors of each active cell instead.

A HashSet is generally a good choice for very sparse infinite grids, however for this problem we’ll pack all dimensions into a single vec to achieve a five times increase in lookup speed.

Modules§

scalar 🔒

Functions§

parse
Use our utility Grid method to parse the input.
part1
Part one cells form a cube.
part2
Part two forms a hypercube.