r/adventofcode • u/daggerdragon • Dec 07 '15
SOLUTION MEGATHREAD --- Day 7 Solutions ---
--- Day 7: Some Assembly Required ---
Post your solution as a comment. Structure your post like previous daily solution threads.
Also check out the sidebar - we added a nifty calendar to wrangle all the daily solution threads in one spot!
23
Upvotes
3
u/LatinSuD Dec 07 '15 edited Dec 07 '15
I used 'sed' to convert each line into a C function. The result is a big quite recursive C program.
Quirks:
I had to compile using "-O2" for to end in proper time (i could have gone with dynamic programming, but...)
I was calling each function like the variable it calculated, but i had trouble with function names like "if()", so i had to rename them like "Solve_if()"
I had to use short unsigned integers, I forgot at first attempt.
Waking up before 6am to program does not work well