r/adventofcode • u/daggerdragon • Dec 18 '19
SOLUTION MEGATHREAD -🎄- 2019 Day 18 Solutions -🎄-
--- Day 18: Advent of Code-Man: Into the Code-Verse ---
--- Day 18: Many-Worlds Interpretation ---
Post your full code solution using /u/topaz2078's paste or other external repo.
- Please do NOT post your full code (unless it is very short)
- If you do, use old.reddit's four-spaces formatting, NOT new.reddit's triple backticks formatting.
NEW RULE: Include the language(s) you're using.
(thanks, /u/jonathan_paulson!)
(Full posting rules are HERE if you need a refresher).
Reminder: Top-level posts in 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's Poems for Programmers
Note: If you submit a poem, please add [POEM] somewhere nearby to make it easier for us moderators to ensure that we include your poem for voting consideration.
Day 17's winner #1: TBD, coming soon! "ABABCCBCBA" by /u/DFreiberg!
Oh, this was a hard one... I even tried to temporarily disqualify /u/DFreiberg sorry, mate! if only to give the newcomers a chance but got overruled because this poem meshes so well with today's puzzle. Rest assured, though, Day 17 winner #2 will most likely be one of the newcomers. Which one, though? Tune in during Friday's launch to find out!
A flare now billows outward from the sun's unceasing glare.
It menaces the ship with its immense electric field.
And scaffolding outside the ship, and bots all stationed there
Would fry if they remained in place, the wrong side of the shield.Your tools: an ASCII camera, a vaccuum bot for dust,
Schematics of the scaffolding. Not much, but try you must.
First, you need your bearings: when the junctions are revealed
You will know just where your vacuum bot can put its wheels and trust.Map all the turns of scaffolding, and
ZIPthem tightly sealed,
Then, map compressed, send out the bot, with not a tick to spare.
Enjoy your well-deserved Reddit Silver, and good luck with the rest of the Advent of Code!
View all comments
Show parent comment
2
u/jat255 Jan 02 '20
Sorry, one other question for you. I'm trying to re-implement this strategy using sets and deques, rather than bits (to make sure I understand how it's working, even though it will likely be too slow). It looks like the
Path.currentattribute is just storing the current position(s) (which is multiple positions for Part B) as which key's position the path is currently on, correct? In part A using the second example (where the min path is 86), the values looks like it goes as follows during the steps (in decimal, then binary, thenpath.length):Based off the rest of the code and how the keys are mapped from letters, to indices, to bits, this looks like it would be the same as saying:
But since there was a branch, it's more like:
Am I getting that right?