Live data from Hacker News

Advent of Code 2022 is nigh

adventofcode.com

101–110 of 150 posts

Re: Advent of Code 2022 is nigh

#101
post #42

Earlier quoted context omitted.

I recently went through the 2021 puzzles and I don't recall having this experience. I also think the choice of language matters a lot. I did it in prolog a few years ago and it was super concise because you just dealt with pure logic at that point. I can see it be more verbose in Java :) but seriously I find these puzzles hard but not in a chore kind of way.

Are your Prolog solutions public? I would love to take a look!

I have only solved one puzzle in Prolog, but here it is: https://github.com/widforss/adventofcode/blob/master/example...

I choosed Prolog for that one as that meant I didn't have to implement the search algo, just state the problem in logic.

Re: Advent of Code 2022 is nigh

#103

I wonder how the persons on the leader board manages it? First person today solved part1 after 39 seoncds, and was done with part2 after 53 seconds! I felt I was quite fast in being done with part1 after 3 minutes and part2 in 4 minutes (rank ~1000). I even tried to skimread the explanation to be fast, have a script to download the input and run it etc., but still no match!

1. Have everything in place at the start (a script to grab the inputs helps). 2. Use a language that makes the edit/run cycle short. 3. Be very familiar with that language and how to process input in it. 4. Have solved many similar problems in the past so you can parse these problem statements quickly. 5. Have solved many similar problems in the past so you know exactly what code to write or use (if you have a utilit…

I have most of it in place, but I guess it's 4&5 I need to improve. I feel like my problem, when comparing to the video posted of today's winner, is that I'm "too safe". I should gamble a bit more, read only parts of it at the chance of misunderstanding, and go with my first thought of implementation even though it may not work. Because the moment I start to consider things the others are already done, heh.

And I guess I could do better on 2, but on this day I only needed 1 run. I use Kotlin, and guess I lose a second or two on it compiling before running. I see today's winner just did everything in browser console as a repl. So that's probably a good way to minimize the loop. Pretty annoying for the later problems, though.

Re: Advent of Code 2022 is nigh

#104

Time for my yearly tradition of making it to day 4 in Haskell and feeling very smart before completely giving up on the first hard problem that needs regular arrays :)

I know exactly what you mean. I'm going to try AoC this year again with Haskell, but this time around I'm just going to cheat and use it as an imperative language.

    {-# LANGUAGE BlockArguments #-}
    {-# LANGUAGE Strict #-}

    stateful s' f = runState f s'

    forEach xs state' f = foldM f state' xs

    solve input = forEach input initial_state $ \st current_value -> stateful st do
        ...

Re: Advent of Code 2022 is nigh

#105

First day was a pretty fun start. Just heard about this for the first time this year and going to give it a go. Tangential question - why does the HN crowd hate these types of questions in interviews but apparently likes to do them on their own time? Different folks answering to different posts? Honestly curious.

Because:

- You can take your time, no pressure.

- You can use whatever language or paradigm you like.

- You don't have to explain anything to anyone.

- You are not ashamed of using hacks or shortcuts.

- It's a learning exercise if you are using a new language.

- You can google for things like "I know this problem needs A* but I forgot how to implement it", which show you know the important part, how to solve the problem, but forgot the useless part, the algorithm itself, which you can easily google.

- There's a single, objective answer to the problem and it gives you hints about it (too low, too high).

If interviews where like this where I could do problems at my own pace at home and then later in the next interview we'd discuss my solution, interviews would be way less stressful and interesting. The interviewer would even know how long I took to solve the problem.

Re: Advent of Code 2022 is nigh

#106

First day was a pretty fun start. Just heard about this for the first time this year and going to give it a go. Tangential question - why does the HN crowd hate these types of questions in interviews but apparently likes to do them on their own time? Different folks answering to different posts? Honestly curious.

Because they are fun! But in an interview environment it can feel like being tested on whether you are cool under pressure and less like you are being assessed for merit.

Re: Advent of Code 2022 is nigh

#107

Every time I do the AoC puzzles I wish for two things: 1) The site should ask for the language used to solve the problem and then use this as semi-scientific data for comparing "time-to-solution" for various languages. The sheer volume of data and the relatively high difficulty of cheating on novel problems would make this data set interesting and maybe even useful. 2) I wish all the puzzles had a "hardcore" mode whe…

> The site should ask for the language used to solve the problem and then use this as semi-scientific data for comparing "time-to-solution" for various languages.

I can't believe any valid causal inference about languages could be drawn from this, because the skill of the individual programmer at solving these types of puzzles (recognizing the patterns, knowing the number theory, etc.) would surely dominate any impact of the language itself.

I suppose you could conclude something along the lines of "newer programmers use Python more often than Haskell", but I doubt there would be many surprises there.

Re: Advent of Code 2022 is nigh

#108
How much external help do you guys seek out for these puzzles?

Last year I solved two puzzles by looking up the answer on reddit, and other than that I tried to solve them as is. But I feel like it is sometimes a bit like solving a puzzle is a bit like reinventing parts of math and computer science if you didn't happen to have learned those from school or a book.

Re: Advent of Code 2022 is nigh

#109

Every time I do the AoC puzzles I wish for two things: 1) The site should ask for the language used to solve the problem and then use this as semi-scientific data for comparing "time-to-solution" for various languages. The sheer volume of data and the relatively high difficulty of cheating on novel problems would make this data set interesting and maybe even useful. 2) I wish all the puzzles had a "hardcore" mode whe…

> The site should ask for the language used to solve the problem and then use this as semi-scientific data for comparing "time-to-solution" for various languages. I can't believe any valid causal inference about languages could be drawn from this, because the skill of the individual programmer at solving these types of puzzles (recognizing the patterns, knowing the number theory, etc.) would surely dominate any impac…

It would work if language to programmer mapping was largely random with respect to skill level, or randomly assigned languages to use rather than giving the programmers a choice, but then you'd also need to give six months notice or something to learn the assigned language if they didn't already know it.

Re: Advent of Code 2022 is nigh

#110

I wonder how helpful GPT-3 and Copilot will be for this :) Not necessarily to solve the whole puzzle but rather to give hints when I'm stuck with a particular task.

Last years I started around the 14th and Copilot auto completed the solutions for all the old problems from basically just the file name. I created a file called 'advent_of_code/1.py' typed 'def main()' and Copilot did everything else.
Post reply on HN