aoc::year2021

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.

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ยง

Type Aliasesยง

  • Input ๐Ÿ”’
    Pad the 10x10 grid by 1 on either side so that we can avoid boundary checks.