Day 1

We've got a list of depth readings. We need to loop over all the numbers, counting those that are greater than the one before. We need to make sure that we don't count the first number as increasing from "nothing".

We are going to need a function that can iterate over a list of numbers, and count them if they are greater.

It's going to keep track of the last number we looked at. We need to ensure that it starts at the first reading, which we do by setting the "last number" to be equal to the starting number. If we wanted to track the depth increasing with the first number, we'd just start last number at 0 instead.

Great, that works. Let's try that on the real list.

That means we are going to want to read the lines in from a file and turn them into numbers. This is a common thing for the advent of code, so there's a pretty common pattern that I tend to use.

We need to strip the whitespace like line endings off of each line, and then turn it into an integer.

Great, we've got the answer for part 1, it's 1624 for my dataset!

Onto...

Part 2

We now need a 3 measurement window instead of just the individual readings. We then sum the window and compare the window sums with each other, still looking for an increase in depth.

So for list a, b, c, d, e, we need something that can return (a,b,c) and then (b,c,d) and so on.

We need to end when the start reaches the total - 2, so we get (total-2, total-1, total)

We'll write a window function that returns just the relevant subset of the list. Because it returns a list itself, we can use the sum function to get the total of adding the three numbers together.

We are going to need a new version of count increases that uses the sliding windows properly.

Most importantly, we need to set the lastnumber equivalent to be the same as the very first window, and we need to make sure that we end 2 before the total number of readings, because we don't want partial windows returned.