Advent of Code - Programming On Unix

Users browsing this thread: 1 Guest(s)
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?


Messages In This Thread
Advent of Code - by piotr - 08-12-2019, 12:28 PM
RE: Advent of Code - by neeasade - 08-12-2019, 07:00 PM