AoC 2021 D2: Dive!
| Problem statement | Source code | Tags: Grid walking
← Previous Back to AoC Index Next →
Part 1
The coordinates are a 2-element array [horizontal, depth], both starting at 0. We just iterate through each command and update the coordinates accordingly.
Part 2
We add an extra aim variable also starting at 0. down and up now modify aim.