Day 8!
Today's tasks felt much easier than yesterday's, but maybe it was because they were closer to what I used to do at $job - 2.
Let's recursiv...
For further actions, you may consider blocking this person and/or reporting abuse
Kinda happy with this one!
Woah, that recursive constructor for
Tree
is really clever!I considered building an object and then processing it after the fact, but decided to process it as I parsed it...I regretted that when I saw part 2 though 😅
deque
FTW! Nice!I was missing parser combinators so came back and did day 8 again.
It was initially much more dense but I tried to break it up to make it easier to follow. It's not the One True Way of parsing for nothing you know!
PHP
Recursion, or: finally a chance to use my degree. Did I need to actually build the tree in Part 2? Probably not, but it made it easier to organize the data and actually do the recursion, so ¯_(ツ)_/¯
Part 1:
Part 2:
Here is my Golang solution for today's problem. It was more easy for me to solve today, but made me learn to use pointers in Golang to consume the input string. I don't think this is necessarily the best way to use pointers, but I liked the simplicity in this case.
Agreed, today's was much simpler. My Kotlin:
Here is my Python Solution:
Both parts
Part 1
Part 2
And here are my Perl solutions:
Part 1
Part 2
@choroba , thanks again for putting this post up! Sorry for not getting it out on time yesterday.
I liked this challenge! Something about this one just worked out for me and I didn't have to wrestle with it very much. Also, this was my first time defining a recursive data structure in Rust, and I didn't have any issues -- hopefully I did it the right way!
Part 1
Part 2
For part 2, I didn't have to change the data structure at all, I just created the
value
function to describe how the new thing was calculated.JavaScript solution
reader.js
08-common.js
08a.js
08b.js
This is my js solution using recursive functions
Part1
Part 2
github.com/ngleich/adventofcode2018/
I liked this challenge a lot! It felt a lot more straightforward than the other problems.
The code came out extremely succinct, too, which is always nice. IMO it's quite readable:
Part 1:
Part 2 looks almost identical to part 1, but with an extra branch in the middle.