Function advent_solutions::advent2017::day11::solve
[−]
[src]
pub fn solve(input: &str) -> (usize, usize)
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,neis3steps away.
assert_eq!(solve("ne,ne,ne").1, 3);
-
ne,ne,sw,swis0steps away (back where you started).
assert_eq!(solve("ne,ne,sw,sw").1, 0);
-
ne,ne,s,sis2steps away (se,se).
assert_eq!(solve("ne,ne,s,s").1, 2);
-
se,sw,se,sw,swis3steps away (s,s,sw).
assert_eq!(solve("se,sw,se,sw,sw").1, 3);
Part Two
How many steps away is the furthest he ever got from his starting position?