nixers
Advent of Code - Printable Version
+- nixers (https://nixers.net)
+-- Forum: Development & Graphics (https://nixers.net/Forum-Development-Graphics)
+--- Forum: Programming On Unix (https://nixers.net/Forum-Programming-On-Unix)
+--- Thread: Advent of Code (/Thread-Advent-of-Code)


Advent of Code - piotr - 08-12-2019

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?


RE: Advent of Code - neeasade - 08-12-2019

very cool!

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