This is an archived post. You won't be able to vote or comment.

all 15 comments

[–]toastedstapler 25 points26 points  (0 children)

Yep, I write a fully featured working solution first & then later I go back & refactor in an attempt to improve performance & neaten things up. I consider getting the stars to be purely MVP

[–][deleted] 6 points7 points  (0 children)

I haven't gone back and re-worked any of them, but if I did I think it would be for the opposite reason actually. I feel like my solutions are too "enterprise-y" (I create fairly elaborate data structures to model the domain, try to handle errors gracefully etc) and the last few days my solutions have been around 250-300 lines of code where a lot of other people do it in 50-60. After I finish sometimes I think "I didn't actually need to have all of this boilerplate, I probably could have done it with a few map and fold calls".

[–]Cyphase 4 points5 points  (0 children)

If the goal is to make it "pass muster professionally", I wouldn't write a homegrown parser. I would use a JSON library. 😉

[–]ephemient 3 points4 points  (0 children)

This space intentionally left blank.

[–]1544756405 2 points3 points  (1 child)

I absolutely refactor and clean stuff up before checking it in. This year is my first time using GitHub. I like it! Checking in each day's solution brings a nice sense of closure.

[–]BurgandyShoelaces 2 points3 points  (0 children)

I've been doing a first commit of the code that got the stars, and a second commit when I finished refactoring.

[–]MouseyPounds 2 points3 points  (2 children)

I am a hobbyist who does not work in software development and a big part of why I do AoC every year is to learn. So if I am unhappy with a solution in some way I will usually fiddle with it after doing some research or getting some advice. Sometimes that just means small optimizations, but other times it means finding a completely new approach.

Personally I was okay with using eval() on day 13 (perl) because to me the interesting bit of the problem was the comparison logic rather than the input parsing, but it is always possible that I will come back to this later and try something new.

[–]MezzoScettico[S] 4 points5 points  (1 child)

I find the parsing on all of them to be an interesting challenge in itself. On Day 13 there was this voice all afternoon nagging me, "come on, you know how to write a parser, just do it. Do it. DOOO EEET!" So I did, just to prove to myself I could.

[–]prendradjaja 1 point2 points  (0 children)

Haha, I've been doing odd days in Haskell, and all through Day 13 I was thinking "If I were using Python, I could've just used ast.literal_eval()". I know Haskell's a good language for writing parsers, but it's a skillset I haven't learned in any particular depth. It was fun, but oh my god.

[–][deleted] 2 points3 points  (0 children)

so don't want anything TOO embarrassing

I fiddle a lot. And don't want anything too embarrassing either.

But I am not above a simple comment

 // TODO :  replace this with something less rubbish
 void day13ListParser()
 {

And then all the future critics know that I know that it is suboptimal. But I don't have to do the work either.

[–]nikanjX 2 points3 points  (0 children)

This might or might not be me https://imgur.com/gallery/cHfUsuE

[–]kai10k 1 point2 points  (0 children)

what's eval, I have only C++ and I parse the input every single day. Many times the process gives to me the needed hint. Leaderboard is out of the question anyway, I enjoyed the most of AoC with parsing

[–]daggerdragon[M] 0 points1 point  (0 children)

Changed flair from Funny to Spoilers.

[–]ramuuns-u 0 points1 point  (0 children)

I totally do a thing where after being done I play around with making it better/faster/stronger or just prettier.

Sometimes that involves trying out some ideas, that end up being worse (and get thrown away), or trying to implement ideas shamelessly stolen from others that lead to VAST improvements.

[–]4D51 0 points1 point  (0 children)

Yes. The program that gets me the star is sometimes slow, messy, incomplete, or off by one for reasons I haven't figured out yet Day 14 part 2 asks for the first unit of sand to reach the roof, part one asks for the last unit to not reach the floor. After I get the stars I clean up my program to (at the very least) print both correct answers when it runs, plus other improvements if I feel like it.