Module day11

Source
Expand description

§Dumbo Octopus

This puzzle resembles the Day 9 flood fill a little. Since there are only 100 octopuses a fixed size array is used both to track current energy levels and a second array to track if an octopus has flashed this turn. Each time an octopus flashes it bumps its neighbors energy levels, which can propagate recursively through the entire grid.

Functions§

bump_octopus 🔒
Increments an octopus’s energy. If it reaches 10, it flashes and is added to the queue.
parse
part1
part2
simulate 🔒

Type Aliases§

Input 🔒
Pad the 10x10 grid by 1 on either side so that we can avoid boundary checks.