Hey OP, great job! While I see your notes that you've cleaned up your solutions after the fact, what you've published is remarkably clean, concise, and beautiful code.
Looking at just Days 1 and 2, the author has given examples that are certainly concise, but (arguably) at the expense of readability. Similarly, the Day 2 part 2 answer is concise at the expense of performance, as there is a lot of duplicated comparisons and comparisons that could be skipped.
Fair point. I wasn't trying to necessarily criticize the solutions, but personally found differences between the given solutions and my own enlightening.
I think it's worth noting that the problems are such that many solution don't need performance, and then later there are problems that do need performance, and of course those that no matter how much performance you had you have to work another approach entirely.
I was amused watching some people doing day 9 having solved it using a good datastructure and confused why p2 was so simple, vs watching people having no idea about their languages performance for the baked in collections they were using.
I love looking at other ways to solve these problems.
But I hope it remains clear to all that there's no singular right way to solve them. I remember writing a few of them thinking, "the big O is terrible but this is so much more obvious to read." Or even, "I bet part 2 will want to do X so I'll make it more robust for refactoring." So many variables. Fun to practice which ones you constrain.
I've enjoyed solving them on my own and then looking at the other solutions in the AoC subreddit. Its really interesting to see how people solve them in lots of languages including the language I wrote in. Usually I learn something new, and even if its in a different language I can see optimisations that I could apply to my solution.
18 comments
[ 0.26 ms ] story [ 52.2 ms ] threadI'm no Norvig, but I thought I'd try my hand at walking the reader through my own solutions this year. This is what I've come up with so far!
I'm currently 9th on the global leaderboard: https://adventofcode.com/2018/leaderboard
Observable has made it fun to follow along and re-run the code.
There are much more interesting, highly optimized solutions and better discussion, animations, etc.
Looking at just Days 1 and 2, the author has given examples that are certainly concise, but (arguably) at the expense of readability. Similarly, the Day 2 part 2 answer is concise at the expense of performance, as there is a lot of duplicated comparisons and comparisons that could be skipped.
I was amused watching some people doing day 9 having solved it using a good datastructure and confused why p2 was so simple, vs watching people having no idea about their languages performance for the baked in collections they were using.
But I hope it remains clear to all that there's no singular right way to solve them. I remember writing a few of them thinking, "the big O is terrible but this is so much more obvious to read." Or even, "I bet part 2 will want to do X so I'll make it more robust for refactoring." So many variables. Fun to practice which ones you constrain.
This thread might help you if you already pass all the tests : https://www.reddit.com/comments/a6f100/-/ebw1uda/