Input:
forward 5
down 5
forward 8
up 3
down 8
forward 2
etc...
Where:
down X increases your aim by X units.
up Y decreases your aim by Y units.
forward Z increases your depth (your current aim multiplied by Z).
Result:
forward 5 -> Because your aim is 0, your depth does not change.
down 5 -> adds 5 to your aim, resulting in a value of 5.
forward 8 -> Because your aim is 5, your depth increases by 8*5=40.
up 3 -> decreases your aim by 3, resulting in a value of 2.
down 8 -> adds 8 to your aim, resulting in a value of 10.
forward 2 -> Because your aim is 10, your depth increases by 2*10=20
Depth = 60
I need to track Aim and depth (z*aim) in top to bottom order (because of the multiplication).
I tried many things but i looks like i'll need custom function, unless anyone has any ideas.
If someone wants to try as well: adventofcode.com/2021
Bookmarks