2016-12-28 14:48:23 +00:00
|
|
|
|
Advent of Code
|
|
|
|
|
|
|
|
|
|
--- Day 24: Air Duct Spelunking ---
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
You've finally met your match; the doors that provide access to the roof are
|
|
|
|
|
locked tight, and all of the controls and related electronics are
|
|
|
|
|
inaccessible. You simply can't reach them.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
|
|
|
|
The robot that cleans the air ducts, however, can.
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
It's not a very fast little robot, but you reconfigure it to be able to
|
|
|
|
|
interface with some of the exposed wires that have been routed through the
|
|
|
|
|
HVAC system. If you can direct it to each of those locations, you should be
|
|
|
|
|
able to bypass the security controls.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
You extract the duct layout for this area from some blueprints you acquired
|
|
|
|
|
and create a map with the relevant locations marked (your puzzle input). 0
|
|
|
|
|
is your current location, from which the cleaning robot embarks; the other
|
|
|
|
|
numbers are (in no particular order) the locations the robot needs to visit
|
|
|
|
|
at least once each. Walls are marked as #, and open passages are marked as
|
|
|
|
|
.. Numbers behave like open passages.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
|
|
|
|
For example, suppose you have a map like the following:
|
|
|
|
|
|
|
|
|
|
###########
|
|
|
|
|
#0.1.....2#
|
|
|
|
|
#.#######.#
|
|
|
|
|
#4.......3#
|
|
|
|
|
###########
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
To reach all of the points of interest as quickly as possible, you would
|
|
|
|
|
have the robot take the following path:
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
|
|
|
|
• 0 to 4 (2 steps)
|
|
|
|
|
• 4 to 1 (4 steps; it can't move diagonally)
|
|
|
|
|
• 1 to 2 (6 steps)
|
|
|
|
|
• 2 to 3 (2 steps)
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Since the robot isn't very fast, you need to find it the shortest route.
|
|
|
|
|
This path is the fewest steps (in the above example, a total of 14) required
|
|
|
|
|
to start at 0 and then visit every other location at least once.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Given your actual map, and starting from location 0, what is the fewest
|
|
|
|
|
number of steps required to visit every non-0 number marked on the map at
|
|
|
|
|
least once?
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Your puzzle answer was 490.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
|
|
|
|
--- Part Two ---
|
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Of course, if you leave the cleaning robot somewhere weird, someone is bound
|
|
|
|
|
to notice.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
What is the fewest number of steps required to start at 0, visit every non-0
|
|
|
|
|
number marked on the map at least once, and then return to 0?
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
2018-03-15 16:24:23 +00:00
|
|
|
|
Your puzzle answer was 744.
|
2016-12-28 14:48:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
References
|
|
|
|
|
|
|
|
|
|
Visible links
|
|
|
|
|
. http://adventofcode.com/
|
|
|
|
|
. http://adventofcode.com/2016/about
|
|
|
|
|
. http://adventofcode.com/2016/support
|
|
|
|
|
. http://adventofcode.com/2016/events
|
|
|
|
|
. http://adventofcode.com/2016/settings
|
|
|
|
|
. http://adventofcode.com/2016/auth/logout
|
|
|
|
|
. http://adventofcode.com/2016
|
|
|
|
|
. http://adventofcode.com/2016
|
|
|
|
|
. http://adventofcode.com/2016/leaderboard
|
|
|
|
|
. http://adventofcode.com/2016/stats
|
|
|
|
|
. http://adventofcode.com/2016/sponsors
|
|
|
|
|
. http://adventofcode.com/2016/sponsors
|
|
|
|
|
. https://en.wikipedia.org/wiki/HVAC
|
|
|
|
|
. http://adventofcode.com/2016
|
|
|
|
|
. http://adventofcode.com/2016/day/24/input
|