Advent of Code - Programming On Unix

Users browsing this thread:
piotr
Members
Hi,

Last year was the first time I took part in the Advent of Code (https://adventofcode.com/2019), and enjoyed it so much I came back this year too.

Some problems this year would take me too much time, so I skipped a few days, but overall it's been a fun week. I thought it would be nice to start a separate thread with solutions to particularly interesting problems.

My favourite so far was day 6 (https://adventofcode.com/2019/day/6), with some simple graph node-counting. To avoid parsing the input (I'm going to use C as long as I can), I used Awk to generate a header file which gets #included:

Code:
#!/usr/bin/env awk -f

BEGIN {
    FS=")";
    print "node nCOM = {.parent = NULL};";
}

{
    print "node n" $2 " = {.parent = &n" $1 "};";
}

Is anyone else taking part? Could you share some solutions that you've found particularly interesting?
neeasade
Grey Hair Nixers
very cool!

I'm currently doing this years in clojure to get a better feel for it -- https://github.com/neeasade/adventofcode