68 lines
1.8 KiB
Cheetah
68 lines
1.8 KiB
Cheetah
|
# No Time For Directions!
|
||
|
|
||
|
__Hermes__ is the Greek god, and amongst others, he is the god of travel, trade,
|
||
|
and athletes. Hermes has placed his hope in you.
|
||
|
|
||
|
You're dropped to a random location near Mount Cyllene in Arcadia, widely
|
||
|
considered the birthplace of Hermes. After years of training, **You** are now
|
||
|
set out on a quest. You must steal a key from __Hecate__, hidden near Mount
|
||
|
Cyllene.
|
||
|
|
||
|
Unfortunately, "near", is as close as you know where you are. The instructions
|
||
|
on the parchment Hermes gave begin from here, however, he never had the time to
|
||
|
tell you how to follow them, or where they lead to.
|
||
|
|
||
|
The document has different markings that appear to tell you which direction to
|
||
|
travel in. They indicade a direction, (`N`, `S`, `E` or `W`), and the number of
|
||
|
steps you must take to find the hiding location.
|
||
|
|
||
|
The problem is, that there's over a 100 different directions, and there's no
|
||
|
time following these directions one by one. It will take far too long! You take
|
||
|
a moment and work out the final destination, so you can get more quickly. Given
|
||
|
that you can only walk in the cardinal directions, what is the shortest path to
|
||
|
the destination?
|
||
|
|
||
|
### Example
|
||
|
|
||
|
- Given the following input
|
||
|
|
||
|
```
|
||
|
N5
|
||
|
E2
|
||
|
S9
|
||
|
W3
|
||
|
```
|
||
|
|
||
|
Instructs you to to travel `5` steps North, `2` steps East, `9` steps South,
|
||
|
and `3` steps West. Simplifying it, means `4` steps South, and `1` step West,
|
||
|
or `5` steps away.
|
||
|
|
||
|
- Given the following input
|
||
|
|
||
|
```
|
||
|
N6
|
||
|
E5
|
||
|
N5
|
||
|
W3
|
||
|
N4
|
||
|
S9
|
||
|
E4
|
||
|
S1
|
||
|
W6
|
||
|
E3
|
||
|
```
|
||
|
|
||
|
Leaves you `5` steps North, and `3` steps East, or `8` steps away.
|
||
|
|
||
|
Each line will have 2 characters of input, the first being the direction, and
|
||
|
the second being the number of steps. The number of steps on each line will
|
||
|
always be between 1 and 9, inclusive, steps.
|
||
|
|
||
|
**How many steps away** is the key?
|
||
|
|
||
|
{{ if ge .Step 2 }}
|
||
|
|
||
|
## Part 2
|
||
|
|
||
|
{{ end }}
|