DEV Community

Discussion on: Advent of Code 2019 Solution Megathread - Day 7: Amplification Circuit

Collapse
 
neilgall profile image
Neil Gall • Edited

Well that was fun! My decision on day 2 to do the machine simulator in C continues to be both an advantage and a disadvantage. I'm enjoying flitting between the low-level pointer hacking and the high-level Prolog and Haskell solutions on other days.

Generating the permutations of the phase signals was the hardest bit today. The principle is a simple one - lock some digits, generate the permutations of the remaining, and recurse - but the details and corner cases in recursive C were a bit tricky.

Today's code runs both parts in 14 milliseconds!

Code at github.com/neilgall/adventofcode20...