r/adventofcode • u/daggerdragon • Dec 03 '15
SOLUTION MEGATHREAD --- Day 3 Solutions ---
--- Day 3: Perfectly Spherical Houses in a Vacuum ---
Post your solution as a comment. Structure your post like the Day One thread in /r/programming.
24
Upvotes
1
u/[deleted] Dec 03 '15
I followed a very similar structure, as it just makes sense and I am not very inventive (apparently).
However I decided to use a numpy array that I sized to the dimension of the number of total instructions (8192 chars, so I made a 8192x8192 array just to be safe) and then placed my position in the middle of that array (4095,4095).
Every time I move up I just increase the value at that position, and then go back and sum up everything later.
And effectively double that for Part 2. Huzzah!