Dec 2018 | Dec 2017 | Dec 2016 | Dec 2015 | Dec 2014 | Dec 2013 | Dec 2012 | Dec 2011 | Dec 2010
-
Subscribe
-
Reading
-
About
Being the thoughts and writings of one Gustaf Erikson; father, amateur photographer, technologist.
Frequently updated microblog.
More stuff can be found at gerikson.tumblr.com and Flickr.
I toot at @gerikson@mastodon.social.
Follow my bookmarks at Pinboard.
I enjoyed this year’s edition more than last year’s.
It was a combination of being slightly easier, and having a better attitude to it coming in. In 2018, I was aiming for as good a result as I had in 2016, which was 49 stars out of 50. This left very little margin for bailing out of tough problems, and led to increased frustration when I didn’t have the time required to solve a problem within 24 hours.
I was thinking of not participating, but as time drew near, I got inspired, and even solved a couple of left-over problems from last year in preparation.
This year I gave myself more leeway for simply bailing on problems that didn’t seem fun. This turned out to be day 21. I also gave up on day 6, which was probably a mistake, and part 2 of day 22.
I also felt that this year was easier than 2018. In part, this was
because of nearly half of the problems being intcode
problems, where
we first had to write an interpreter for a specific machine code, and
then apply that interpreter to various fun follow-up questions, like
playing
Breakout
or
Adventure.
Then I had a lot of support from the dedicated IRC channel from lobste.rs. I’d like to thank regulars jjuran, wink, gthm and tumdum for encouragement and friendly competition.
I still have a number of stars to get, but unlike last year, I’m looking forward to solving those problems.
Ett djupdyk kring Frankrikes inrikespolitik kring 1407. Författaren har inte mycket till övers för Barbara Tuchmans A Distant Mirror men jag tycker båda verken har sina förtjänster.
Nordberg gör ett försök att rehabilitera Ludvig av Orléans från burgundiska smädesskrifter, men är inte lika vältalig som Mantel om Thomas Cromwell.
Project website: Advent of Code 2019.
Previous years: 2015, 2016, 2017, 2018.
I use Perl for all the solutions.
Most assume the input data is in a file called input.txt
in the same
directory as the file.
Current score (2020-12-25): 46. I’m aiming for a final of 44+1.
I score my problems to mark where I’ve finished a solution myself or given up and looked for hints. A score of 2 means I solved both the daily problems myself, a score of 1 means I looked up a hint for one of the problems, and a zero score means I didn’t solve any of the problems myself.
My goals for this year (in descending order of priority):
Day 1 - Day 2 - Day 3 - Day 4 - Day 5 - Day 6 - Day 7 - Day 8 - Day 9 - Day 10 - Day 11 - Day 12 - Day 13 - Day 14 - Day 15 - Day 16 - Day 17 - Day 19 - Day 20 - Day 21 - Day 22 - Day 23 - Day 24 - Day 25
A nice and simple problem to kick off this year.
Score: 2
An earlier appearance of register rodeo than expected! I think we’ll see more of this going forward.
[intcode
part 1]
Score: 2
This took longer than it had to. I messed up adding the paths, and only managed to get the correct answer to part 1 by chance. Once I plotted the example data I could correct the code, then add the logic for part 2.
I’m not entirely happy with the duplicated direction subroutines. Some people have used complex numbers to simplify this but that would require a separate Perl module to implement.
Score: 2.
I blanked on this one and dreaded combinatorics. Turns out brute force
is eminently doable. Credits to
/u/andreyrmg
in the daily solutions thread, and A_D
and sim642
in the IRC
channels for help in inspiration.
I still think my solution is my own though (and pretty Perlish), so full score today.
Score: 2.
After struggling with the convoluted problem description I was pleasantly surprised to find my code ran flawlessly first try. I still have some niggling issues with the test data, and need to clear that up before the inevitable next intcode
problem.
[intcode
part 2]
Score: 2.
I bailed on this one and sought inspiration in the daily solutions subreddit. Credit in source!
Score: 0.
A tough, but fun one. There were a lot of subtleties in the second part, and I got some pointers from the subreddit.
I got the chance to clean up my intcode
implementation, and learned a new facet of Perl.
[intcode
part 3]
Score: 2.
Defying expectations (and maybe fears), this Sunday problem was not that complicated.
Of course, it helps if you confirm that what you think is input actually is the same as the problem input. Not that I’d have anything other than theoretical knowledge of this situation…
Score: 2.
Day 9 - complete solution Day 9 - complete solution
So the Intcode computer is done, and we’ve amassed a number of test cases to ensure it works. I’m kinda sorta happy with my code. It’s not the most elegantly put together but it works fine.
[intcode
part 4]
Score: 2.
This was a fun one, even though I got sidetracked by my incorrect assumptions and got lost in a hallway of indices, all alike.
Part 2 was found by inspecting the output, but hey, a star is a star.
Score: 2.
Ah, the return of Langton’s ant. Always nice to see an old friend.
Nothing too complex here, although I’m quite proud of the line noise for the dispatch table for movement:
my %directions = (
'^'=>sub{!$_[0]?['<', 0,-1 ]:['>', 0, 1 ]},
'<'=>sub{!$_[0]?['v', 1, 0 ]:['^',-1, 0 ]},
'v'=>sub{!$_[0]?['>', 0, 1 ]:['<', 0,-1 ]},
'>'=>sub{!$_[0]?['^',-1, 0 ]:['v', 1, 0 ]},
);
[intcode
part 5]
Score: 2.
A fun little problem.
Score: 2.
I am in awe of what the creator of Advent of Code has wrought in the form of intcode
.
[intcode
part 6]
Score: 2.
A hard problem that was satisfying to solve.
Score: 2.
Not my proudest moment. I’m happy my intcode
implementation works well enough for this kind of application now, but my utter inability to code a BFS routine is humiliating. In the end I had to use a modified Djikstra’s that I cribbed for last year’s day 22.
[intcode
part 7]
Score: 2.
Day 16 - part 1 Day 16 - part 2
I had a lot of trouble with part 2, mostly due to indexing errors.
Runtime is 2m16s for part 2, which is just barely acceptable.
Score: 2
This one was a slog!
I was very worried that my intcode
interpreter was incorrect, but it was actually just me not being able to read the input specification correctly.
[intcode
part 8]
Score: 2.
This was supposed to be a breather…
From the beginning I realized that this problem is best expressed as x in terms of y, instead of the more usual y in term of x, and I made a mental note not to mix them up.
Of course, many hours later I realized I had done that just that.
[intcode
part 9]
Score: 2.
Part 1 yields easily to a modified BFS approach.
Update 2020-12-26
Part 2 is similar, only adding the “dimension” of the recursive level. There some really scruffy code to figure out the “edges” of the transition.
Score: 1.
I felt zero interest in trying to puzzle this out so found some closed forms on the subreddit.
[intcode
part 10]
Score: 0.
Part one only done for now, part 2 requires way too much weird (read modular) math for me. Damnit, Cap’n, I’m continuous, not discrete!
Score: 1.
A remarkably straight-forward puzzle.
[intcode
part 11]
Score: 2.
Day 24 - part 1 Day 24 - part 2
An interesting problem.
Update 2020-12-25 I revisited this after the multiple Games of Life in 2020. Instead of trying to be clever figuring out how to calculate the neighbors, I just created a giant lookup table.
This Reddit post contains all iterations of the example input and was helpful for debugging.
Score: 2
A fitting end to a good edition of Advent of Code!
Score: 2.