blob: 1088955fb0dfe20dc80493045a40f036d4e0fb53 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
--- Part Two ---
Now, you just need to figure out how many [1m[97morbital transfers[0m you (YOU) need to take to get to Santa
(SAN).
You start at the object YOU are orbiting; your destination is the object SAN is orbiting. An orbital
transfer lets you move from any object to an object orbiting or orbited by that object.
For example, suppose you have the following map:
COM)B
B)C
C)D
D)E
E)F
B)G
G)H
D)I
E)J
J)K
K)L
K)YOU
I)SAN
Visually, the above map of orbits looks like this:
[1m[97mYOU[0m
[1m[97m/[0m
G - H [1m[97mJ - K[0m - L
/ [1m[97m/[0m
COM - B - C - [1m[97mD - E[0m - F
[1m[97m\[0m
[1m[97mI - SAN[0m
In this example, YOU are in orbit around K, and SAN is in orbit around I. To move from K to I, a
minimum of 4 orbital transfers are required:
- K to J
- J to E
- E to D
- D to I
Afterward, the map of orbits looks like this:
G - H J - K - L
/ /
COM - B - C - D - E - F
\
I - SAN
[1m[97m\[0m
[1m[97mYOU[0m
[1m[97mWhat is the minimum number of orbital transfers required[0m to move from the object YOU are orbiting to
the object SAN is orbiting? (Between the objects they are orbiting - [1m[97mnot[0m between YOU and SAN.)
|