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.
Constantsยง
- NEIGHBORS ๐Offsets for each of the eight neighbors. The last four offsets will wrap around when added to
u8
to give a smaller index.
Functionsยง
- simulate ๐
Type Aliasesยง
- Input ๐Pad the 10x10 grid by 1 on either side so that we can avoid boundary checks.