Advent of Code is something of a bad habit for me, partially because of the schedule. (For people on the east coast states, it starts at midnight.)
Still, it's kind of fun, and it's not like project euler where people are asked to not share solutions. (There's a very short time frame where people are asked to not share solutions, but there's a reddit thread with solutions for every day's problems. But, almost nothing in J appears in that thread, and here is more fun.) Anyways, I figured I might dump solutions here for AoC puzzles with a 20 day lag. That should give most people who are following it time to figure things out on their own without quite the level of pressure which forms the bad habits. AoC day 1 was a warmup https://adventofcode.com/2021/day/1 Every AoC puzzle starts out with a little story which represents a fictional "use case" that your code would be addressing. And, each has two parts. Here, for the first part you are trying to find out if "sonar readings" are increasing more often than they are decreasing, or decreasing more often than they are increasing, looking at adjacent pairs of readings sample=: 199 200 208 210 200 207 240 269 260 263 aoc1=: {{ +/ 2</\ y}} And then the second part asks us to consider pairs of moving averages with a width of 3 rather than simply pairs of readings. aoc2=: {{ +/ 2</\ 3 +/\ y}} This one is pretty easy, (and I had not formed any bad habits yet for this one, so I solved it something like 11 hours after it was posted... I will not speak further of how long it took me to solve any of these puzzles). I am planning on going through the later puzzles (one per day), and posting them to the programming forum (with a small amount of comment on the approach, where that seems to fit). But this one was quite simple. And, this post is somewhat meta. So comment here if you would prefer I not do this or if you have suggestions to consider or whatever else. Thanks, -- Raul ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
