Advent of Code 2018 - 25x2 coding puzzles for December

Yup, this. In some cases PowerShell’s magic with type inference can be nice, but other times it’s a real pain.

5 Likes

If anyone is stuck on that part of Day 6, here’s how the math for that works:

Let’s imagine some coordinates A=(x1,y1), B=(x2,y2), … Z=(x26,y26)

You can draw a box, with corners at (0,0), (0,m), (n,0), and (m,n), containing all of those coordinates. Let’s say that the location at (15,n) is closest to coordinate A.

If you expand the box one row further, of the locations already within the box, the locations (15,n+1) will be closest to the location (15,n). Since that location is closest to coordinate A, therefore the location (15,n+1) is also closest to coordinate A.

This can be extended to each of the four sides of the box, and thereby determined that if any location on the perimeter of the box is closest to a coordinate, the number of locations closest to that coordinate is infinite.

Determining that was (other than my own inability to multiply) the hardest part of Day 6 for me, so hopefully it helps some of you progress.

2 Likes

Thanks for your clear explanation. That actually a lot of sense.

I’ll be honest that my interest has kind of waned since the shit show of Day 6 (that, and I have been feeling pretty lazy and unmotivated to begin with) but I may have to pick it up again starting tomorrow.

1 Like

Well, between sickness, some crazy work deadlines, and other issues, it doesn’t look like I’m ever going to catch back up on the calendar this year. Ah well.

3 Likes

I came to that realization myself a few days ago. Although, for me, it’s not so much schedule or circumstances as it is that it’s simply taking me too long to solve each puzzle. At my current pace I’ll finish sometime in late January. :slight_smile:

So that means that as friendly competition, or daily koan, or even just an opportunity to chat with like-minded peers, this whole endeavor is kind of a wash. I’ve been feeling like it’s kind of pointless, and yet…

I keep noodling on last night’s puzzle when my thoughts wander or I have a few minutes of downtime at work. And when I get home, as often as not I can’t resist spending a bit (or a big chunk) of time plinking away at my current puzzle. Part of it, I think, is that it scratches an itch that I haven’t really been satisfying lately. But part of it is also that they are kind of clever and/or interesting puzzles.

I was treating them as standard word-problems or exercises at first, but they really are puzzles, and when I started reading them as such, i.e. with the understanding that they will include details that are meaningless or even downright misleading, things got a bit easier. Day 10, for instance, includes data that is pretty obviously a vector of sorts, but when they described it like this, " a point with velocity <1, -2> is moving to the right, but is moving upward twice as quickly," I focused on the “twice as quickly” aspect. So instead of a simple pair of delta-x, delta-y, I started with delta-x, delta-x * delta-y, and so my first iteration was correct but all the subsequent ones were incorrect.

I also thought it was interesting that for this puzzle, there’s no easy/obvious way to define a halting state in the code. For my solution, I had to basically run it until it got “close enough”, then use a breakpoint so that I could manually inspect each iteration until the answer looked correct. Or I could have pulled in some sort of OCR library, but that seemed like overkill for the kind of puzzle of which I should be able to solve two-at-a-time in a single sitting.

2 Likes

I kind of lost my motivation and I’ve been pretty busy lately. The general consensus I’ve seen on Reddit is that this year is considerably harder than last year. I think it’s just that some of the coding problems required very specific solutions or weren’t explained very clearly.

4 Likes

i kind of hate programming challenges, cause it reminds me how bad at programming i am.

I’M ALSO SAD I ONLY SAW THIS NOW.

in some theoretical land, if a person’s next day off wasn’t till the 2nd day of 2019, would they still be able to participate?

( ummm… asking for a friend. )

4 Likes

The problems stay on-line, so if you wanted to run on your own calendar, there’s certainly no stopping you. Enjoy!

5 Likes

I’m not sure if the leaderboard still works, but if it does you’re still more than welcome to join.

I’ll be sure to set up another team next year. If this is something that you’re interested in, I’d be happy to look into other opportunities. CodeWars has a clan system, for example.

2 Likes