Advent of code

Dec 9, 2022

Dec 8, 2022

I solved this puzzle with CartesianIndices. Though I'm not sure that was really necessary, I chose to because I wanted to get more familiar with them. I still don't totally grasp the point of them, but I have a nebulous feeling that they could be very powerful, if only I understood them deeply. Indexing always kind of scares me — it isn't super intuitive (and I know there's a whole debate about 0-indexed vs 1-indexed, which arguments on both sides about being more intuitive).

I also discovered readeach which reads an IO stream character by character. Another "tech" that was totally unnecessary for today (probably better just to read the trees in as a matrix, honestly) but, as I said, I see AoC primarily as a way to learn tricks!

Dec 9, 2022

I can feel the difficulty ramping up! This one wasn't too bad after a while. I used Complex numbers since they are a convenient unbounded two-dimensional space. It worked pretty well. Only afterwards did I see someone used CartesianIndex items for this problem! I was one day too early, perhaps.

send a comment