Live data from Hacker News

Advent of Code 2023 is nigh

adventofcode.com

41–50 of 319 posts

Re: Advent of Code 2023 is nigh

#42

I think I’d like to try this year’s in a language I haven’t touched before. What languages should I consider if I want something paradigmatically different from Go, Python, etc?

I built an OCaml starter project for Advent of Code that I've been using. Take a look if you'd like to give OCaml a spin!

https://github.com/Sixstring982/tanenbaum

Re: Advent of Code 2023 is nigh

#43
post #24

Part two was exceptionally hard. Many people on reddit reporting they were hit by one edge case that's not covered in the examples. But my implementation passed these edge cases too. I was hit by another edge case. So there are at least two edge-cases (which are in the actual data) that aren't covered in the examples or the description.

It was a little frustrating that the main edge case that caught everyone didn't blow up my implementation, and going row by row of the 1000 line input it wasn't immediately obvious where it was going wrong (I'm not sure how far down I would've had to go to find the first time it hits this edge case, I just ended up checking the reddit for hints).

I really do think things like this should at least be hinted in the text to save a little frustration; I'm not trying to be the best on the leaderboard, I'm just doing these in the morning before work for a little fun.

Re: Advent of Code 2023 is nigh

#45
post #24

Part two was exceptionally hard. Many people on reddit reporting they were hit by one edge case that's not covered in the examples. But my implementation passed these edge cases too. I was hit by another edge case. So there are at least two edge-cases (which are in the actual data) that aren't covered in the examples or the description.

I failed at first try but I found a hint by looking at the example character by character.

Re: Advent of Code 2023 is nigh

#46
post #24

Part two was exceptionally hard. Many people on reddit reporting they were hit by one edge case that's not covered in the examples. But my implementation passed these edge cases too. I was hit by another edge case. So there are at least two edge-cases (which are in the actual data) that aren't covered in the examples or the description.

Warning: post contains spoilers, HN doesn't support spoiler text so continue reading at your peril.

These edge cases are triggered by fundamentally approaching the problem incorrectly.

In some ways it's excellent to bring that up early in a way that's relatively easy to debug and diagnose.

Like many others I started with the wrong solution, and I was hit by the same problematic cases, but what I found interesting was that some developers went further down a rabbit hole of trying to force replacement to work (e.g. replacing "one" with "one1one", etc) rather than taking a step back and re-thinking the approach entirely and thinking about the problem as a searching problem.

Re: Advent of Code 2023 is nigh

#47
post #27
post #24

Part two was exceptionally hard. Many people on reddit reporting they were hit by one edge case that's not covered in the examples. But my implementation passed these edge cases too. I was hit by another edge case. So there are at least two edge-cases (which are in the actual data) that aren't covered in the examples or the description.

Generally, such edge-cases usually make the solution ugly and the process unpleasant. The aim of such puzzles should be a pleasant process culminating with a beautiful solution.

The potential for overlapping numbers was the thing that tripped up many developers. But a simple “find the first number searching from each end, just like the puzzle instructions asked” implementation just worked.

The lesson is to read the puzzle instructions carefully and avoid solving more general problems.

Re: Advent of Code 2023 is nigh

#48

I think I’d like to try this year’s in a language I haven’t touched before. What languages should I consider if I want something paradigmatically different from Go, Python, etc?

I used it last year to exercise my utterly novice clojure skills and found that very enjoyable and educational.

Re: Advent of Code 2023 is nigh

#50
post #46
post #24

Part two was exceptionally hard. Many people on reddit reporting they were hit by one edge case that's not covered in the examples. But my implementation passed these edge cases too. I was hit by another edge case. So there are at least two edge-cases (which are in the actual data) that aren't covered in the examples or the description.

Warning: post contains spoilers, HN doesn't support spoiler text so continue reading at your peril. These edge cases are triggered by fundamentally approaching the problem incorrectly. In some ways it's excellent to bring that up early in a way that's relatively easy to debug and diagnose. Like many others I started with the wrong solution, and I was hit by the same problematic cases, but what I found interesting was…

Further spoiler: I replaced "one" with "o1e", "two" with "t2o", etc. which is hacky as hell, but works for throwaway contest code. (Replacing as suggested above also works, but is more typing.)

That let me keep the problem in the filter/map/first-last/reduce space, which was the shape of my solution to part 1.

Post reply on HN