58 lines
1.9 KiB
Plaintext
58 lines
1.9 KiB
Plaintext
|
Advent of Code
|
|||
|
|
|||
|
--- Day 11: Hex Ed ---
|
|||
|
|
|||
|
Crossing the bridge, you've barely reached the other side of the stream when a program comes up to you, clearly in distress. "It's my child process," she says, "he's gotten lost in an infinite grid!"
|
|||
|
|
|||
|
Fortunately for her, you have plenty of experience with infinite grids.
|
|||
|
|
|||
|
Unfortunately for you, it's a hex grid.
|
|||
|
|
|||
|
The hexagons ("hexes") in this grid are aligned such that adjacent hexes can be found to the north, northeast, southeast, south, southwest, and northwest:
|
|||
|
|
|||
|
\ n /
|
|||
|
nw +--+ ne
|
|||
|
/ \
|
|||
|
-+ +-
|
|||
|
\ /
|
|||
|
sw +--+ se
|
|||
|
/ s \
|
|||
|
|
|||
|
You have the path the child process took. Starting where he started, you need to determine the fewest number of steps required to reach him. (A "step" means to move from the hex you are in to any adjacent hex.)
|
|||
|
|
|||
|
For example:
|
|||
|
|
|||
|
• ne,ne,ne is 3 steps away.
|
|||
|
• ne,ne,sw,sw is 0 steps away (back where you started).
|
|||
|
• ne,ne,s,s is 2 steps away (se,se).
|
|||
|
• se,sw,se,sw,sw is 3 steps away (s,s,sw).
|
|||
|
|
|||
|
Your puzzle answer was 747.
|
|||
|
|
|||
|
--- Part Two ---
|
|||
|
|
|||
|
How many steps away is the furthest he ever got from his starting position?
|
|||
|
|
|||
|
Your puzzle answer was 1544.
|
|||
|
|
|||
|
Both parts of this puzzle are complete! They provide two gold stars: **
|
|||
|
|
|||
|
References
|
|||
|
|
|||
|
Visible links
|
|||
|
. http://adventofcode.com/
|
|||
|
. http://adventofcode.com/2017/about
|
|||
|
. http://adventofcode.com/2017/support
|
|||
|
. http://adventofcode.com/2017/events
|
|||
|
. http://adventofcode.com/2017/settings
|
|||
|
. http://adventofcode.com/2017/auth/logout
|
|||
|
. http://adventofcode.com/2017
|
|||
|
. http://adventofcode.com/2017
|
|||
|
. http://adventofcode.com/2017/leaderboard
|
|||
|
. http://adventofcode.com/2017/stats
|
|||
|
. http://adventofcode.com/2017/sponsors
|
|||
|
. http://adventofcode.com/2017/sponsors
|
|||
|
. https://en.wikipedia.org/wiki/Hexagonal_tiling
|
|||
|
. http://adventofcode.com/2017
|
|||
|
. http://adventofcode.com/2017/day/11/input
|