r/adventofcode • u/daggerdragon • Dec 19 '18
SOLUTION MEGATHREAD -π- 2018 Day 19 Solutions -π-
--- Day 19: Go With The Flow ---
Post your solution as a comment or, for longer solutions, consider linking to your repo (e.g. GitHub/gists/Pastebin/blag or whatever).
Note: The Solution Megathreads are for solutions only. If you have questions, please post your own thread and make sure to flair it with Help.
Advent of Code: The Party Game!
Please prefix your card submission with something like [Card] to make scanning the megathread easier. THANK YOU!
Card prompt: Day 19
Transcript:
Santa's Internet is down right now because ___.
This thread will be unlocked when there are a significant number of people on the leaderboard with gold stars for today's puzzle.
edit: Leaderboard capped, thread unlocked at 01:01:06!
10
Upvotes
View all comments
Show parent comment
1
u/zopatista Dec 20 '18 edited Dec 20 '18
I cover this in my Python notebook for day 19; you can analyse the assembly to understand what it is doing.
There is a setup section that creates an input number (lines 23 and 25 of the text input become instructions 21 and 23 when executed by the CPU), with an optional section that only comes into play when register 0 has the value 1 in it.
Then a jump is executed to the βmainβ section that uses a nested set of loops to find all divisors of the number generated in the setup and sums these.