Advent of Code 2021 Day 2


The problem for day 2 is another simple one. The input is a list of instructions and these are applied to a point (The original position of the submarine) to yield a new position.

Parts 1 and 2 are pretty similar, only differing in the way the instructions are applied. A slight twist in that a “down” instruction increases the y dimension. Not a difficult concept for someone whose day job is a mobile application development.

My solution in swift is a bit longer because I added a some strong typing around creating and applying the instructions, rather than just switching on the string.